日期:2011-09-09  浏览次数:20477 次

 

最近学习了正则表达式和小偷程序设计,旁边有玩英雄联盟的朋友,便突发奇想做一个游戏资料库,查看英雄技能等等的,下面是代码,其实是小偷程序,目的是简化web页面,方便手机查看,英雄资料来自多玩英雄联盟资料库。大家看完还可以做其他的资料库,把知识学以致用才是关键!

01 <?php
02 header("Content-Type: text/html; charset=utf-8");date_default_timezone_set("Asia/Shanghai");
03 function li($p)
04 {
05 $l=file_get_contents("http://lol.duowan.com/s/heroes.html");
06 preg_match_all('!<li.*<a.*href=.*http:\/\/lol.duowan.com\/heros\/(.*)\/.*<img.*champion_icon.*src=(.*)<h3.*class=.*champion_title">(.*)<\/h3>.*<span.*class="champion_search_text">(.*)<\/span>.*<\/li>!suU',$l,$list);
07 $ay=ceil(count($list[1])/30);
08 if($p==NULL){$p=1;}
09 if($p<0$p>$ay){die('error');}
10 $sta=30*($p-1);
11 $end=30*$p;
12 for($p2=$sta;$p2<$end;$p2++)
13 {$ys=$p2%3;$m=$list[1][$p2];
14 if($ys==2){$hh="<hr/>";}else{$hh=" ";}
15 if($m!=NULL)
友情链接: 爱易网 云虚拟主机技术 云服务器技术 程序设计技术 开发网站 APP开发教程
Copyright © 2013-2024 爱易网页 当前在线:553人  网站在9时30分38秒内访问总人数:113945人 当前 20.62%  粤ICP备18100884号-2