htmlentities() 函数把字符转换为 HTML 实体。
html_entity_decode() 函数把 HTML 实体转换为字符。
例子:
$a = '<div> <p>11111&&222</p></div>';
$b = htmlentities($a);
$c = html_entity_decode($b);
echo $b."\n";
echo $c;
页面输出:
htmlentities输出内容:<div> <p>11111&&222</p></div>
html_entity_decode输出内容:11111&&222
htmlentities详情:http://www.w3school.com.cn/php/func_string_htmlentities.asp
html_entity_decode详情:http://www.w3school.com.cn/php/func_string_html_entity_decode.asp