Home  >  Article  >  php教程  >  PHP实现英雄联盟资料库查看

PHP实现英雄联盟资料库查看

WBOY
WBOYOriginal
2016-06-21 08:50:362544browse

 

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

01

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('!(.*).*(.*).*!suU',$l,$list);

07 $ay=ceil(count($list[1])/30);

08 if($p==NULL){$p=1;}

09 if($p$ay){die('error');}

10 $sta=30*($p-1);

11 $end=30*$p;

12 for($p2=$sta;$p2

13 {$ys=$p2%3;$m=$list[1][$p2];

14 if($ys==2){$hh="
";}else{$hh=" ";}

15 if($m!=NULL)

16 {$l2=$l2."".$list[3][$p2]."".$hh;

17 }

18 }

19 $l2=$l2."
";

20 for($dy=1;$dy

21 {if($dy!=$p)

22 {$l2=$l2." ".$dy." ";}

23 else

24 {$l2=$l2." ".$dy." ";}

25 }

26 $time=date("Y.m.d H:i");

27 $l2="英雄联盟—资料库WAP在线
英雄联盟—资料库
".$l2." [ ".$p." / ".$ay."]
为易首页.留言反馈 .相关说明
Time: ".$time."
Powered by Vst93
Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn