PHP html_entity_decode不按预期解码实体吗?

时间:2017-02-16 23:29:52

标签: php html-entities

在以下代码中:

    A    B    C    D
1   1         1    =COUNTIF(A:A,C1)
2   2         2    =COUNTIF(A:A,C2)
3   3         3    =COUNTIF(A:A,C3)
4   5         4    =COUNTIF(A:A,C4)
5   3         5    =COUNTIF(A:A,C5)
6   2

$ string2仍然包含:

$string1 = "function doesn't work as expected";
$string2 = html_entity_decode($string1);

...在调用html_entity_decode()之后。

我已经检查过这个主题的其他SO主题,但尚未找到答案。我错过了什么?

1 个答案:

答案 0 :(得分:3)

html_entity_decode的{​​{3}}不包含单引号。尝试更新flags参数以包含ENT_QUOTESENT_HTML5

$string1 = "function doesn't work as expected";
echo $string2 = html_entity_decode($string1, ENT_QUOTES|ENT_HTML5);
// function doesn't work as expected