<?php echo "Hello World!"; ?>
应该是:
<?php echo "Hello World!"; ?>
我如何在 PHP 中做到这一点?
最佳答案
您需要其中之一:
html_entity_decode()
htmlspecialchars_decode()
主要区别在于 html_entity_decode()
将翻译字符串中的所有 HTML 实体( <
变为 <
, á
变为 á
等),而 html_specialchars_decode()
只翻译一些特殊的 HTML 实体:
The converted entities are:
&
,"
(when ENT_NOQUOTES is not set),'
(when ENT_QUOTES is set),<
and>
.
关于php - 如何将 & 字符转换为 HTML 字符?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/6665985/