if($_GET[id] $con=file_get_contents ("http://book.qq.com/lianzaiindex/sort4/index_".$_GET['id'].".htm"); //echo $con; $preg = "# (.*)#iUs"; preg_match_all($preg,$con,$arr); $time=time(); foreach ($arr[1] as $k=>$v){ echo $v." ".$arr[2][$k].""; $sql="insert into tmp_url (url,title,addtime) values ('".$v."','".$arr[2][$k]."','$time')"; $db->query($sql); } $_GET['id']++; echo "正在采集www.2cto.com。。。。".$_GET[id]; echo "location.href='stahtml.php?id=".$_GET[id]."'"; }else { echo "采集结束"; } 摘自 chaojie2009的专栏