set_time_limit(0);$getUrl = 'http://moneyflow.cnfol.com/Now.asp';$strPattern = '/<DIV style=\"WIDTH: 1390px\">(.*?)<!--分页-->/is';
$strContent = @file_get_contents($getUrl);preg_match($strPattern, $strContent, $strResult);
echo($strResult[1]);
对于上面这段代码,file_get_contents每次都能取到内容,可是preg_match有时能匹配到内容,有时又不行。不知道是什么原因,不知道大家有没有遇到过。在线急等,已经被折腾两天了。谢谢~
set_time_limit(0);$getUrl = 'http://moneyflow.cnfol.com/Now.asp';$strPattern = '/<DIV style=\"WIDTH: 1390px\">(.*?)<!--分页-->/is';
$strContent = @file_get_contents($getUrl);preg_match($strPattern, $strContent, $strResult);
echo $strContent; // echo 出来看一下
echo($strResult[1]);
pcre.backtrack_limit=-1
增加了这个也不行。。file_get_contents 每次都有内容。就是匹配不到内容。郁闷啊
$strPattern = '/<DIV style=\"WIDTH: 1390px\">(.*)<!--分页-->/is';
preg_match 只匹配一次,看这个正则是不是能确定你要匹配的内容