Get the total donation amount of ThinkPHP, just for fun, don’t take it too seriously
- /**
- * Calculate the total number of ThinkPHP donations
- */
- $money_sum = 0; //Total amount
- $page_sum = 51; //Total number of pages, no need to get it automatically, just write it directly
- for($j=1; $j<=$page_sum; $j++){
- $url = "http://www.thinkphp.cn/donate/index/p/".$j.".html";
-
- $content_area = substr(file_get_contents($url), 10068);
- $main_area = substr($content_area, 0, -3970);
-
- preg_match_all('/¥(.* )/', $main_area, $money_arr);
-
- for($i=0; $i {
- $money_sum += $money_arr[ 1][$i];
- }
- }
- echo $money_sum;
- ?>
Copy code
|