当我输出某些内容(来自我的utf-8 db)时,如
this "text" is nice
html代码显示
this "text" is nice
如何使用php准确显示撇号"
?
由于
答案 0 :(得分:0)
使用函数htmlentities:
echo htmlentities('this "text" is nice');
答案 1 :(得分:0)
从PHP手册:
<?php
$orig = "I'll \"walk\" the <b>dog</b> now";
$a = htmlentities($orig);
$b = html_entity_decode($a);
echo $a; // I'll "walk" the <b>dog</b> now
echo $b; // I'll "walk" the <b>dog</b> now
?>