Heim >Backend-Entwicklung >PHP-Tutorial >统计ThinkPHP的捐赠总额,仅为娱乐,不要太较真

统计ThinkPHP的捐赠总额,仅为娱乐,不要太较真

WBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWB
WBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOriginal
2016-07-25 08:47:431297Durchsuche
获取ThinkPHP的捐赠总额,仅为娱乐,不要太较真
  1. /**
  2. * 计算ThinkPHP捐赠总数
  3. */
  4. $money_sum = 0; //总金额数目
  5. $page_sum = 51; //总页数,没用自动获取,直接写的
  6. for($j=1; $j $url = "http://www.thinkphp.cn/donate/index/p/".$j.".html";
  7. $content_area = substr(file_get_contents($url), 10068);
  8. $main_area = substr($content_area, 0, -3970);
  9. preg_match_all('/¥(.*)/', $main_area, $money_arr);
  10. for($i=0; $i {
  11. $money_sum += $money_arr[1][$i];
  12. }
  13. }
  14. echo $money_sum;
  15. ?>
复制代码


Stellungnahme:
Der Inhalt dieses Artikels wird freiwillig von Internetnutzern beigesteuert und das Urheberrecht liegt beim ursprünglichen Autor. Diese Website übernimmt keine entsprechende rechtliche Verantwortung. Wenn Sie Inhalte finden, bei denen der Verdacht eines Plagiats oder einer Rechtsverletzung besteht, wenden Sie sich bitte an admin@php.cn