6

我想使用 php html_entity_decode() 解码 html 实体,但我的 html 实体似乎与该函数不兼容。

Example Input String: html_entity_decode('<strong>');
Outputs: <strong>

删除'amp;'解决了问题并产生了,<strong>但我的文件'amp;'在每个 html 实体之前都有。大规模删除amp;可能会解决问题,但对 html 也非常具有破坏性。是否可以在所有实体之前以这种额外的情况转换我的amp;实体?

4

1 回答 1

15

它是双重编码的 - 将字符串运行html_entity_decode()两次。

echo html_entity_decode( html_entity_decode('&amp;lt;strong&amp;gt;'));

将输出

<strong>
于 2012-07-20T14:40:43.630 回答