从此简单Dom网站
if(isset($html-> div#sidebar ))
{
$sidebarFile = D:xampphtdocsfinalwordpresssidebar.php ;
$openSidebarFile = fopen($sidebarFile, a );
foreach($html->find( div#sidebar )) as $e)
{
$html ->find( div[id=sidebar] , 0) -> innertext;
$inputSidebar = $e->outertext;
fwrite($openSidebarFile, "
" .inputSidebar "
");
}
}
From the documentation: it says:
// Determine whether a attribute exist?
if(isset($e->href))
echo href exist! ;