为什么 html_entity_decode() 适用于第一个字符串,而不适用于第二个?
Why is html_entity_decode() working for the first string, but not the second?
$string1 = 'Cotton Lanyard ½"';
$string2 = 'Organic Cotton Lanyard ⅝"';
echo html_entity_decode($string1); //Cotton Lanyard ½"
echo html_entity_decode($string2); //Organic Cotton Lanyard ⅝"
不确定如何解决这个问题?
它适用于 HTML5 文档类型 flag。
echo html_entity_decode($string2, ENT_HTML5); // Organic Cotton Lanyard ⅝"
因为默认类型是 ENT_HTML401
(HTML 4.01),我想这意味着 ⅝ 实体没有在那里定义。
$string1 = 'Cotton Lanyard ½"';
$string2 = 'Organic Cotton Lanyard ⅝"';
echo html_entity_decode($string1); //Cotton Lanyard ½"
echo html_entity_decode($string2); //Organic Cotton Lanyard ⅝"
不确定如何解决这个问题?
它适用于 HTML5 文档类型 flag。
echo html_entity_decode($string2, ENT_HTML5); // Organic Cotton Lanyard ⅝"
因为默认类型是 ENT_HTML401
(HTML 4.01),我想这意味着 ⅝ 实体没有在那里定义。