爲什麼簡單的HTML DOM無法在此代碼中工作?這是一個錯誤嗎?以前我從來沒有遇到過這樣的問題。簡單的Html Dom無法在此代碼中工作
該HTML代碼太大,不能在這裏發佈。
file.php
<?php
require_once './simple_html_dom.php';
$html = file_get_html('http://sitelab.combr.co/codenotwork.html');
var_dump($html); //bool(false)
?>
爲什麼簡單的HTML DOM無法在此代碼中工作?這是一個錯誤嗎?以前我從來沒有遇到過這樣的問題。簡單的Html Dom無法在此代碼中工作
該HTML代碼太大,不能在這裏發佈。
file.php
<?php
require_once './simple_html_dom.php';
$html = file_get_html('http://sitelab.combr.co/codenotwork.html');
var_dump($html); //bool(false)
?>
使用pQuery代替: https://github.com/tburry/pquery
也許有一些問題與源站點的代碼,這LIB無法解析,或者有問題與分析器。
我看着simple_html_dom代碼並解決了問題。問題是因爲html代碼太大而且simple_html_dom具有大小限制。這只是改變定義('MAX_FILE_SIZE',600000);
你會得到什麼錯誤? – stefan
你應該嘗試使用DOMDocument/DOMXpath而不是簡單的html dom。 http://php.net/domxpath – Kaylined
'file_get_html()'編碼不好,不會給出任何錯誤。將代碼複製到其中(使用默認值),然後調試它。有三個部分可能會出錯。 – szako