html_entity_decode不工作如何解决?

时间:2018-01-19 12:02:21

标签: php

PHP:

html_entity_decode('<p style="font-size:18px;color:#ff0000">Cancelled</p>');
htmlspecialchars_decode('<p style="font-size:18px;color:#ff0000">Cancelled</p>');

输出:

<p style="font-size:18px;color:#ff0000">Cancelled</p>

您好,大家好,我尝试了两种解决方案,但这使得它成为字符串而不是HTML。我该如何解决这个问题?

1 个答案:

答案 0 :(得分:0)

只需添加echo:

echo html_entity_decode('<p style="font-size:18px;color:#ff0000">Cancelled</p>');
echo htmlspecialchars_decode('<p style="font-size:18px;color:#ff0000">Cancelled</p>');
相关问题