예제 #1
0
 public function testExample()
 {
     $exmp = new Example();
     $this->assertEquals(strpos($exmp->test(), 'h') == 2, true);
 }
예제 #2
0
파일: example.php 프로젝트: hanccc/crawler
            $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();