gpt4 book ai didi

PHP:解码 Html 实体

转载 作者:可可西里 更新时间:2023-11-01 13:09:32 26 4
gpt4 key购买 nike

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

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

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

最佳答案

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

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

will output :

<strong>

关于PHP:解码 Html 实体,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/11581555/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com