UTF-8特殊字符输出



当我(从utf-8db)输出类似的东西时

this "text" is nice

html代码显示

this "text" is nice

如何用php精确显示撇号"

感谢

使用函数htmlentities:

echo htmlentities('this "text" is nice');

使用html_entity_decode

来自PHP手册:

<?php
 $orig = "I'll "walk" the <b>dog</b> now";
 $a = htmlentities($orig);
 $b = html_entity_decode($a);
 echo $a; // I'll &quot;walk&quot; the &lt;b&gt;dog&lt;/b&gt; now
 echo $b; // I'll "walk" the <b>dog</b> now
?>

最新更新