示例#1
0
 public function testExample()
 {
     $exmp = new Example();
     $this->assertEquals(strpos($exmp->test(), 'h') == 2, true);
 }
示例#2
0
            $this->maxPage = $match[1];
        }
    }
}
class YgdyDetailCrawler extends \Hanccc\DetailCrawler
{
    /**
     * @param $url string
     * @return bool
     */
    public function isDetailUrl($url)
    {
        return preg_match('/gndy\\/dyzz\\/(\\d+)\\/(\\d+).html/', $url);
    }
    public function handle()
    {
        echo $this->crawler->filter('title')->text() . PHP_EOL;
    }
}
class Example
{
    function test()
    {
        $listCrawler = new YgdyListCrawler(__DIR__ . '/');
        $listCrawler->setDetailCrawler(new YgdyDetailCrawler());
        $listCrawler->start();
    }
}
$test = new Example();
$test->test();