$string="A 'quote' is <b>bold</b>";
echo $string;//output-->A 'quote' is bold
$string=htmlentities($string, ENT_QUOTES, "UTF-8");
echo $string;//output-->A 'quote' is <b>bold</b>
我的 php 版本是 5.4.6
我想编码单引号和标签
$string="A 'quote' is <b>bold</b>";
echo $string;//output-->A 'quote' is bold
$string=htmlentities($string, ENT_QUOTES, "UTF-8");
echo $string;//output-->A 'quote' is <b>bold</b>
我的 php 版本是 5.4.6
我想编码单引号和标签
尝试 htmlspecialchars
<?php
$string="A 'quote' is <b>bold</b>";
echo $string."<br/>";//output-->A 'quote' is bold
$string=htmlentities($string, ENT_QUOTES, "UTF-8");
echo $string."<br/>";//output-->A 'quote' is <b>bold</b>
$string=htmlspecialchars($string);
echo $string."<br/>";
?>