0
我正在使用「simple_html_dom.php」從維基百科網站中刪除數據。如果我運行scraperwiki.com中的代碼,它會拋出一個錯誤,如退出狀態139,並且如果在我的xampp服務器中運行相同的代碼,服務器將掛起。simple_html_dom.php
- 我有一組鏈接
- 我試圖從所有的網站得到素養值
- 如果我運行一個鏈接的代碼是沒有問題的,它的返回預期的結果
- 如果我嘗試,我所面臨的上述問題從一個全力以赴的網站獲取數據
的代碼是:
<?php
$test=array
(
0 => "http://en.wikipedia.org/wiki/Andhra_Pradesh",
1 => "http://en.wikipedia.org/wiki/Arunachal_Pradesh",
2 => "http://en.wikipedia.org/wiki/Assam",
3 => "http://en.wikipedia.org/wiki/Bihar",
4 => "http://en.wikipedia.org/wiki/Chhattisgarh",
5 => "http://en.wikipedia.org/wiki/Goa",
for($ix=0;$ix<=9;$ix++){
$content = file_get_html($test[$ix]);
$tables = $content ->find('#mw-content-text table',0);
foreach ($tables ->children() as $child1) {
foreach($child1->find('th a') as $ele){
if($ele->innertext=="Literacy"){
foreach($child1->find('td') as $ele1){
echo $ele1->innertext;
}}} }}
指導我哪裏錯了。有沒有內存問題?有沒有xampp配置?
將函數中循環中的代碼換行。然後在循環內運行該函數。它會防止內存泄漏。 – 2013-03-31 12:08:05
嘗試添加'set_time_limit($秒)' –