什么PHP函数将允许我打印$ str =“ ”? [关闭]

问题描述 投票:-3回答:1

我正在尝试实现以下代码。

<!DOCTYPE HTML>  
<html>
<head>
</head>
<body>  
<?php
$str="<Source of the rule. E.g. stakeholder>";
echo $str;
?>
</body>
</html>

但是我无法使用echo命令在屏幕上将字符串作为输出输出。我也使用了strip_tags函数,但是没有用。谁能帮助我使用PHP打印确切的字符串。输出为黑屏。屏幕上什么都没有打印。

php string output html-entities strip-tags
1个回答
3
投票

使用htmlentitieshtml_entity_decode的组合

$str='<Source of the rule. E.g. stakeholder>';
echo htmlentities(html_entity_decode($str));
© www.soinside.com 2019 - 2024. All rights reserved.