PHP convert html 到空间, >到>等
我想将所有html标签(  >><等)转换为文本格式;我试过了
html_entity_decode()
但它会回来?if  .
我想将所有html标签(  >><等)转换为文本格式;我试过了
html_entity_decode()
但它会回来?if  .
使用与 相反。
PHP 文档页面中的示例:htmlspecialchars_decode
htmlspecialchars
$str = '<p>this -> "</p>';
echo htmlspecialchars_decode($str);
//Output: <p>this -> "</p>
html_entity_decode() 与 htmlentities() 相反,因为它将字符串中的所有 HTML 实体转换为其适用的字符。
$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