/is",$r,$booktitle);//匹配此页面的标题 $bookname = $booktitle[1];//取第二层数组 $preg = '/
"; } header("Content-Type:text/html;charset=gb2312"); writer($bookname." 共".$bookzj."节\r\n帅哥刘并于".date("D M j G:i:s T Y")."为了毕业而设计小说整理收集\r\n", "./ailaopo/".$bookname.".txt","w+"); for ($i=0;$i<$bookzj;$i++) { //echo "http://book.sina.com.cn".$zj[1][$i]".shtml";die(); //用file_get_contents将章节连接打开并读取所打开的页面的内容 $str = file_get_contents("http://book.sina.com.cn".$zj[1][$i].".shtml"); preg_match("/(
"; } echo "小说".$bookname."共".$bookzj."节 已全部整理完成!"; function writer($content,$url,$mode)//定义函数名 writer 参数$content,$url,$mode { $fp = fopen($url, $mode);//打开文件$url fwrite($fp, $content);//把$content放入到$fp fclose($fp); //关闭$fp } ?>










