请帮我。。。
图像->我的结果
我的测试结果,我不知道为什么?
price("http://www.example.com/"); -> work
price("http://www.example2.com/"); -> not work
试着切换线路。
price("http://www.example2.com/"); -> work
price("http://www.example.com/"); -> not work
这是我的剧本。。。
<?php
include_once('simple_html_dom.php');
function price($url){
$html = file_get_html($url);
foreach($html->find('span[class=col-right]') as $li){
echo $li->innertext;
}
}
price("http://www.example.com/");
price("http://www.example2.com/");
?>
由于php5循环引用内存泄漏,在创建DOM对象后,如果多次调用file_get_DOM(),则必须调用$DOM->clear()来释放内存。
示例:
$html = file_get_html(...);
// do something...
$html->clear();
unset($html);