开发者

PHP html decoding help - converting: A &#039;quote&#039; is <b>bold</b>

开发者 https://www.devze.com 2023-01-13 19:00 出处:网络
I need to convert a string like this: A &#039;quote&#039; is <b>bold</b> 开发者_StackOverflow中文版

I need to convert a string like this:

A &#039;quote&#039; is <b>bold</b>
开发者_StackOverflow中文版

into:

A 'quote' is <b>bold</b>

html_entity_decode() did not work.


Make sure you use the right quote_style:

html_entity_decode('A &#039;quote&#039; is <b>bold</b>', ENT_QUOTES);

ENT_QUOTES Will convert both double and single quotes. (PHP Manual: html_entity_decode)


mb_convert_encoding($string, "UTF-8", "HTML-ENTITIES");

You can replace "UTF-8" with whatever encoding you need (though depending on the encoding you choose, certain characters may not be representable).

0

精彩评论

暂无评论...
验证码 换一张
取 消