Exemplo n.º 1
0
 public function stop()
 {
     $stop = false;
     if (Component::UrlQueue()->lengthQueue() == 0) {
         $stop = true;
     }
     if ($this->presentLevel == $this->maxLevel && $this->maxLevel != 0) {
         $stop = true;
     }
     if ($stop) {
         //stop钩子,当爬虫停止前执行的钩子,没有任何参数
         Component::Hook()->exeHook("stop");
         exit;
     } else {
         return true;
     }
 }