Home > php教程 > php手册 > 【转】很好的采集页面并正则分析示例,计算tp捐赠总数

【转】很好的采集页面并正则分析示例,计算tp捐赠总数

WBOY
Release: 2016-06-07 11:41:17
Original
1358 people have browsed it

本段是转载的,看到标题也挺想知道结果,结果是 $money_sum 。。。。大家多多捐赠吧,也挺少的。
<?php <br /> /**<br>   * 计算ThinkPHP捐赠总数<br>   */<br>  <br> $money_sum = 0;     //总金额数目<br> $page_sum = 51;     //总页数,没用自动获取,直接写的<br> for($j=1; $j     $url = "http://www.thinkphp.cn/donate/index/p/".$j.".html";<br>  <br>     $content_area = substr(file_get_contents($url), 10068);<br>     $main_area = substr($content_area, 0, -3970);<br>      <br>     preg_match_all('/<span>¥(.*)/', $main_area, $money_arr);<br>      <br>     for($i=0; $i<count></count>     {<br>         $money_sum += $money_arr[1][$i];<br>     }<br> }<br> echo $money_sum;//31541.05<br> ?></span>

AD:真正免费,域名+虚机+企业邮箱=0元

source:php.cn
Statement of this Website
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
Popular Recommendations
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template