我想创建一个爬虫,从0到10 000 000逐个获取所有页面的信息.我不需要花多少时间.我只是希望它有效.这是我获得的错误
Fatal error: Maximum function nesting level of '100' reached, aborting! in D:\wamp\www\crawler\index.php on line 25
第25行是
$htmlstr = (string)$this->curlGet($url);
Run Code Online (Sandbox Code Playgroud)
还有我完整的脚本.
谢谢您的帮助 !
header('Content-Type: text/html; charset=utf-8');
ini_set('max_input_nesting_level','100000');
ini_set('max_execution_time','100000');
class crawler{
private $url;
private $page;
private $bothurl;
private $innerDom = null;
public $prop;
public $entry;
function __construct($entry){
$this->entry = $entry;
$this->bothurl = array('http://www.remax-quebec.com/fr/inscription/Q/'.$entry.'.rmx','http://www.remax-quebec.com/en/inscription/Q/'.$entry.'.rmx');
$this->scan();
}
private function scan(){
$i =0;
foreach($this->bothurl as $url){
$this->url = $url;
$this->lang = ($i==0)?'fr':'en';
$htmlstr = (string)$this->curlGet($url);
$dom = new DOMDocument;
@$dom->loadHTML($htmlstr);
$this->page = …Run Code Online (Sandbox Code Playgroud) 我正在与由Doctrine管理的实体合作开发Symfony项目.以下是我的实体的代码:
class User {
/**
* @ORM\OneToMany(targetEntity="Appointment", mappedBy="user")
*/
private $appointments;
/**
* Get appointments
*
* @return \Doctrine\Common\Collections\ArrayCollection
*/
public function getAppointments()
{
return $this->appointments;
}
/**
* Get appointments at a specified date
*
* @param \DateTime $date
* @return \Doctrine\Common\Collections\Collection|static
*/
public function getAppointmentsAtDate(\DateTime $date) {
$allAppointments = $this->getAppointments();
$criteria = Criteria::create()->where(/* some clever filtering logic goes here */);
return $allAppointments ->matching($criteria);
}
}
Run Code Online (Sandbox Code Playgroud)
getAppointments是由Doctrine自动生成的.该getAppointmentsAtDate方法由我自己实施.该方法的PHPDoc标头由PhpStorm自动生成.
我无法理解的是static我的自定义方法的返回类型中的关键字.
根据我对PHPDoc类型的 理解,static表示此方法返回调用它的类的实例,在本例中为User …