ページネーションを作成するために、このhtmlページを解析したい:
<div class="clear"></div>
<div id="ctl00_MainContent_PaperList_PageNavigator" class="page-navigator">
<a id="ctl00_MainContent_PaperList_Prev" title="Go to Previous Page" class="nextprev"
href="/Search?query=text%20summarization&s=0&start=1&end=10">Previous<a>
<a href="s=0&start=1&end=10">1</a> <span class="current">2</span>
<a id="ctl00_MainContent_PaperList_Next" title="Go to Next Page" class="nextprev"
href="/ Search?query=text%20summarization&s=0&start=21&end=30">Next</a>
<div>
前のページについては、前のページを解析して次のページに移動する必要があります。コードは次のとおりです。
$html = file_get_html($url) or die ('');
if($link = $html->find('div[class=page-navigator] ')) {
$previous = $link->first_child()->href;
$next = $link->last_child()->href;
$html->clear();
unset($html);
// other process
}
私はまだエラーが発生しますFatal error: Call to a member function first_child() on a non-object in D:\AppServ\www\coba\page\page1.php on line 18
どうしたの。ありがとうございました :)