【发布时间】:2011-04-04 05:28:34
【问题描述】:
我需要像这样转换一个字符串:
A 'quote' is <b>bold</b>
进入:
A 'quote' is <b>bold</b>
html_entity_decode() 不起作用。
【问题讨论】:
标签: php html-encode
我需要像这样转换一个字符串:
A 'quote' is <b>bold</b>
进入:
A 'quote' is <b>bold</b>
html_entity_decode() 不起作用。
【问题讨论】:
标签: php html-encode
确保使用正确的quote_style:
html_entity_decode('A &#039;quote&#039; is <b>bold</b>', ENT_QUOTES);
ENT_QUOTES 将转换双引号和单引号。 (PHP Manual: html_entity_decode)
【讨论】:
mb_convert_encoding($string, "UTF-8", "HTML-ENTITIES");
您可以将“UTF-8”替换为您需要的任何编码(尽管根据您选择的编码,某些字符可能无法表示)。
【讨论】: