1
我正在使用此WebCrawler類http://phpcrawl.cuab.de。有一個名爲「setTmpFile()」http://phpcrawl.cuab.de/classreference.html#settmpfile的方法。我想知道如何使用這種方法?請給我一些很好的例子。如何使用phpcrawl類的setTmpFile()方法?
我正在使用此WebCrawler類http://phpcrawl.cuab.de。有一個名爲「setTmpFile()」http://phpcrawl.cuab.de/classreference.html#settmpfile的方法。我想知道如何使用這種方法?請給我一些很好的例子。如何使用phpcrawl類的setTmpFile()方法?
該方法將下載的內容流式傳輸到指定的文件。我不知道爲什麼你需要改變這個文件(PHPCrawl會自動創建一個),但這裏有一個例子:
$crawler = new MyCrawler();
$tmpFilename = tempnam('/tmp', 'crawler_');
$crawler->setTmpFile($tmpFilename);