码迷,mamicode.com
首页 > Web开发 > 详细

PHP Warning: DOMDocument::loadHTML(): htmlParseEntityRef: expecting ';' in Entity,

时间:2015-10-07 10:50:59      阅读:151      评论:0      收藏:0      [点我收藏+]

标签:

$html = file_get_contents("http://www.somesite.com/");

$dom = new DOMDocument();
$dom->loadHTML($html);

echo $dom;

THROWS

Warning: DOMDocument::loadHTML(): htmlParseEntityRef: expecting ‘;‘ in Entity,
Catchable fatal error: Object of class DOMDocument could not be converted to string in test.php on line 10

(1) calling htmlentities() or similar on the string will fix the problem.

(2)To evaporate the warning, you can use libxml_use_internal_errors(true)

From: http://stackoverflow.com/questions/1685277/warning-domdocumentloadhtml-htmlparseentityref-expecting-in-entity

PHP Warning: DOMDocument::loadHTML(): htmlParseEntityRef: expecting ';' in Entity,

标签:

原文地址:http://www.cnblogs.com/CheeseZH/p/4858274.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!