首页 > 代码库 > preg_match_all

preg_match_all

<meta charset="utf8"><?phpset_time_limit (0);for($i=1;$i<34;$i++){    $url = "http://www.cnblogs.com/hellowzd/default.html?page=".$i;    $str=file_get_contents($url);    preg_match_all(‘|阅读\((.*?)\) 评论|i‘,$str,$m);    $data[] = $m[‘1‘];        preg_match_all(‘|class="postTitle2"(.*?)</a>|i‘,$str,$m1);    $data1[]=$m1[‘1‘];            $i=0;    foreach ($data as $k=>$v){        $i++;        $content[$i][‘count‘] = $v;    }        $i=0;    foreach ($data1 as $k=>$v){        $i++;        $content[$i][‘content‘] = $v;    }        echo "<pre>";    print_r ($content);    echo "</pre>";        /* foreach ($content as $key=>$value){        if($value[‘count‘] >100){            echo $value[‘content‘]."------------".$value[‘count‘]."<br>";        }    } */    }?>

 

preg_match_all