时间:2021-07-01 10:21:17 帮助过:31人阅读
loadHTMLFile($page_url);$div_contents = $doc->getElementsByTagName('div');print_r($div_contents);foreach($div_contents as $div_content ){ $items = $div_content->getAttribute("class"); $itme_value = $items->nodeValue;}echo $items_value;
$link[]=array();$page_url='http://smart-phones.biyixia.com/node/1013';//$content=get_data($page_url);$doc= new DOMDocument();@$doc->loadHTMLFile($page_url);$xPath = new DOMXPath($doc);$div_tags = $xPath->evaluate("/html/body//div//@class");for($i=0;$i<$div_tags->length;$i++){ $div_tag=$div_tags->item($i); $div_contents=$div_tag->nodeValue; echo $div_contents; echo "
";}
图像尺寸
你都会xpath,还要问么?
自己用firebug或类似插件查一查就知道xpath了