加入收藏 | 设为首页 | 会员中心 | 我要投稿 李大同 (https://www.lidatong.com.cn/)- 科技、建站、经验、云计算、5G、大数据,站长网!
当前位置: 首页 > 百科 > 正文

‘xmlParseEntityRef:no name’在将xml加载到php文件时发出警告

发布时间:2020-12-16 01:58:14 所属栏目:百科 来源:网络整理
导读:我使用simplexml_load_file读取php中的xml。但是,当尝试加载xml时,它显示警告列表 Warning: simplexml_load_file() [function.simplexml-load-file]: project orderno="6" campaign_name="International Relief Development" project in /home/bluecard1/p
我使用simplexml_load_file读取php中的xml。但是,当尝试加载xml时,它显示警告列表
Warning: simplexml_load_file() [function.simplexml-load-file]: <project orderno="6" campaign_name="International Relief & Development" project in /home/bluecard1/public_html/test.php on line 3    
Warning: simplexml_load_file() [function.simplexml-load-file]: ^ in /home/bluecard1/public_html/test.php on line 3    
Warning: simplexml_load_file() [function.simplexml-load-file]: http://..../index.php/site/projects/:15: parser error : xmlParseEntityRef: no name in /home/bluecard1/public_html/test.php on line 3

Warning: simplexml_load_file() [function.simplexml-load-file]: ional Relief & Development" project_id="313" client_name="International Relief & in /home/bluecard1/public_html/test.php on line 3    
Warning: simplexml_load_file() [function.simplexml-load-file]: ^ in /home/bluecard1/public_html/test.php on line 3    
Warning: simplexml_load_file() [function.simplexml-load-file]: http://..../index.php/site/projects/:15: parser error : xmlParseEntityRef: no name in /home/bluecard1/public_html/test.php on line 3

如何纠正以删除这些警告?

(XML是从url http://…./index.php/site/projects&加载到test.php中的一个变量中生成的,我没有对index.php写入priveleges)

问题可能是“&”
$text=preg_replace('/&(?!#?[a-z0-9]+;)/','&amp;',$text);

将摆脱“&”并用它的HTML代码版本替换它…试试。

(编辑:李大同)

【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容!

    推荐文章
      热点阅读