0
我正在构建一个网站,它从另一个网站上抓取数据,将其存储在数据库中并以表格的形式显示。只要行数较少(大约100),一切都可以正常工作,但是当数据集增加时,比如说300行或更多的数据存储在数据库(phpmyadmin)中,但屏幕上并没有显示任何内容,并且该站点只保留加载。下面是PHP脚本我运行的部分:php脚本悬挂大型数据集
<?php
// configuration
require("../includes/helpers.php");
// initializing current page and number of pages
$page = 0;
$pages = 1;
// scrape data from each page
while($pages--)
{
// next page
$page++;
// scrape data from shiksha.com
$string = @file_get_contents("http://www.shiksha.com/b-tech/colleges/b-tech-colleges-".urlencode($_POST["city"])."-{$page}");
if($string === false)
apologize("Please enter a valid city name");
if($page === 1)
{
// counting total number of pages
preg_match_all('/class=" linkpagination">/',$string,$result);
$pages = sizeof($result[0]);
}
// passing the string for scraping data and storing in database
get_college_info($string,$page);
// delay for 2s
sleep(2);
}
// querying the infrastructure table for facilities of all colleges
$infra = query("SELECT college_id,facilities FROM infrastructure ");
// preparing query and selecting data from table college_info
$result = query("SELECT * FROM college_info");
// render(output) results
render("result.php",["title" => "result","infra" => $infra,"result" => $result]);
}
}?>
有趣的是,如果我已经有存储在我的数据库中的数据,我只是检索和打印,一切工作正常,所有的数据,但是大型IT是,打印出来。我不知道最新的问题。 PS:我已经试过set_time_limit()。
我不认为多数民众赞成在问题,无论如何我试过了,它仍然没有工作。 @ user3299379 –