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


$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)

  libxml的鏈接:http://www.w3school.com.cn/php/php_ref_libxml.asp

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


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM