<table cellspacing="0" cellpadding="0"><tr><td class="t_f" id="postmessage_66296"> <div class="blockcode"> <div id="code_evJ"><ol> <li> //获取指定URL页面中所有链接 </li> <li> function get_url_href($url){ </li> <li> $html = file_get_contents($url); </li> <li> $dom = new DOMDocument(); </li> <li> @$dom->loadHTML($html); </li> <li> $xpath = new DOMXPath($dom); </li> <li> $hrefs = $xpath->evaluate('/html/body//a'); </li> <li> for($i=0;$i<$hrefs->length;$i ){ </li> <li> $href = $hrefs->item($i); </li> <li> $url = $href->getAttribute('href'); </li> <li> if(substr($url,0,4) == 'http') echo $url.'<br>'; </li> <li> } </li> <li> } </li> </ol></div> <em onclick="copycode($('code_evJ'));">复制代码</em> </div> <br> </td></tr></table> <div class="ptg mbm mtn"> PHP、網址</div> <div id="comment_66296" class="cm"> </div> <div id="post_rate_div_66296"></div> <br><br>