3 回答

繁華開滿天機(jī)
TA貢獻(xiàn)1816條經(jīng)驗 獲得超4個贊
使用解碼html_entity_decode或使用刪除它們preg_replace:
$Content = preg_replace("/&#?[a-z0-9]+;/i","",$Content);
(從這里)
編輯:根據(jù)雅科的評論的替代
用{2,8}或其他內(nèi)容替換'+'可能會很好。當(dāng)出現(xiàn)未編碼的“&”時,這將限制替換整個句子的機(jī)會。
$Content = preg_replace("/&#?[a-z0-9]{2,8};/i","",$Content);

阿晨1998
TA貢獻(xiàn)2037條經(jīng)驗 獲得超6個贊
您可能想在這里看看htmlentities()和html_entity_decode()
$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
添加回答
舉報
0/150
提交
取消