Home>Article>Backend Development> Statistics of the total amount of donations from ThinkPHP are for entertainment only, do not take it too seriously.

Statistics of the total amount of donations from ThinkPHP are for entertainment only, do not take it too seriously.

WBOY
WBOY Original
2016-07-25 08:47:43 1201browse
Get the total donation amount of ThinkPHP, just for fun, don’t take it too seriously
  1. /**
  2. * Calculate the total number of ThinkPHP donations
  3. */
  4. $money_sum = 0; //Total amount
  5. $page_sum = 51; //Total number of pages, no need to get it automatically, just write it directly
  6. for($j=1; $j<=$page_sum; $j++){
  7. $url = "http://www.thinkphp.cn/donate/index/p/".$j.".html";
  8. $content_area = substr(file_get_contents($url), 10068);
  9. $main_area = substr($content_area, 0, -3970);
  10. preg_match_all('/¥(.* )/', $main_area, $money_arr);
  11. for($i=0; $i {
  12. $money_sum += $money_arr[ 1][$i];
  13. }
  14. }
  15. echo $money_sum;
  16. ?>
Copy code


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