【发布时间】:2018-04-02 09:52:52
【问题描述】:
我的数据库值为École Polytechnique Fédérale de Lausanne。我无法转换为 html 字符。我尝试使用以下方法进行转换,
echo html_entity_decode(École Polytechnique Fédérale de Lausanne');
echo html_entity_decode($Event['Event_speaker']);
第一个语句我得到了实际结果,第二个语句显示与 db 值完全相同。
在我的标题中使用
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<meta charset="utf-8">
有人可以帮忙吗?
【问题讨论】:
-
您的字符串中没有 HTML 实体。为什么叫 html_entity_decode?span>
-
“第二个显示与 db 值完全相同” – 好的,那么您正确地输出了数据库中的内容,这很好。问题是您的数据库中有垃圾。
标签: php html utf-8 string-decoding