请帮帮我.我有这个错误
<Name>secret CAKES & CAFÉ
imited</Name>
XML Parsing Error: undefined entity
Location: http://localhost/xml.php
Run Code Online (Sandbox Code Playgroud)
在我的PHP
htmlentities($row['companys'],ENT_QUOTES)
Run Code Online (Sandbox Code Playgroud)
É 是一个 html 实体,而不是 xml 实体,因此您只能在 html 或 xhtml 文档中使用它,而不能在 xml 文档中使用它。
\n\nxml中只定义了5个实体
\n\n\n\n您应该在 xml 文档中将所有其他实体保留为 unicode 字符,然后如果您需要将它们转换为 html 实体,请在显示 xml 中的数据时执行此操作,而不是在创建 xml 文档时执行此操作(即,这样 \xc3\ xa9是解析xml后转换的)
\n\n或者,您可以在 xml 文档中定义其他 html 实体。php htmlentities页面上的这条评论使用了这个方法
\n\nhttp://www.php.net/manual/en/function.htmlentities.php#84327
\n