无为清净楼资源网 Design By www.qnjia.com
由于只是一个小示例,所以过程化简单写了,小菜随便参考,大神大可点解
<"/教程列表.*教程列表/s",$html,$body_html); // 返回数据 $data = array(); //判断是否存在要获取的内容 if(count($body_html)){ // 获取页面指定信息 preg_match_all('/<a class="avatar".*user_id="(\S*)" href="(\S*)" rel="external nofollow" /',$body_html[0],$info_1); preg_match_all('/<a href="(.*)" rel="external nofollow" .*title="(.*)"/',$body_html[0],$info_2); $info = array_merge($info_1,$info_2); //组合的信息 for($index=0; $index<count($info[0]); $index++){ //以文章信息作为key存数组,以及覆盖旧数据 $data[$info[4][$index]] = array( 'user_id' => $info[1][$index], 'user_home' => $info[2][$index], 'a_url' => $info[4][$index], 'a_title' => $info[5][$index], ); } } return $data; } header("Content-type: text/html; charset=utf-8"); echo '<pre>'; // 初始化数据 $page_no = 1; $data_all = array(); // 分页获取数据 do{ $url = 'http://www.thinkphp.cn/code/examples/p/' . $page_no; $data = getPageData($url); $data_all += $data; $page_no ++; }while ($page_no <= 10); //当前只获取10页,如果要全部获取则把条件换成$data或!empty($data) var_dump($data_all); ?>
接下的入表库当然就不写了,那些更小意思了~就此别过吧~
总结
以上就是这篇文章的全部内容了,希望本文的内容对大家的学习或者工作具有一定的参考学习价值,谢谢大家对的支持。如果你想了解更多相关内容请查看下面相关链接
无为清净楼资源网 Design By www.qnjia.com
广告合作:本站广告合作请联系QQ:858582 申请时备注:广告合作(否则不回)
免责声明:本站文章均来自网站采集或用户投稿,网站不提供任何软件下载或自行开发的软件! 如有用户或公司发现本站内容信息存在侵权行为,请邮件告知! 858582#qq.com
免责声明:本站文章均来自网站采集或用户投稿,网站不提供任何软件下载或自行开发的软件! 如有用户或公司发现本站内容信息存在侵权行为,请邮件告知! 858582#qq.com
无为清净楼资源网 Design By www.qnjia.com
暂无评论...
更新日志
2024年09月25日
2024年09月25日
- 纯音入心系列纯音乐《天籁古筝》1CD[MP3][331MB]
- 男女对唱典藏天碟《发烧对唱·那个季节里的歌DSD》10CD[WAV]
- 群星2010-歌林精选辑[歌林][WAV+CUE]
- TrioZimbalist-PianoTriosofWeinberg,Auerbach,Dvorak(2024)[24-44,1]wav
- 群星.1992-滚石第一流台湾歌·12王牌大车拼【滚石】【WAV+CUE】
- 林子祥.1984-创作歌集【华纳】【WAV+CUE】
- 周汤豪.2010-周汤豪【华纳】【FLAC分轨】
- Mozart-TheStringQuintets-AmadeusQuartet,CecilAronowitz(2017)[24-44,1][WAV+CUE]
- JamesWilliamsDennisIrwin-Focus(2024,Red)[24-48]FLAC
- 藤泽麻衣《空みあげて》[WAV]
- 纯音入心系列纯音乐《中国古筝经典名曲》1CD[MP3][1.3GB]
- 纯音入心系列纯音乐《古筝新奏:岁月静好与筝语,细水流年与筝同》1CD[MP3][846.9MB]
- 670《脆弱敏感小女生》[320K/MP3][27.53MB]
- 曾琳.2011-好好爱我【南方】【WAV+CUE】
- 范晓萱.1995-RAIN【福茂】【WAV+CUE】