導航:首頁 > 編程語言 > php獲取頁面所有鏈接

php獲取頁面所有鏈接

發布時間:2024-08-29 10:35:17

A. 怎麼從html源碼中獲取URL鏈接

1、火狐瀏覽器 點到一個空白的頁面 右鍵 查看源代碼 裡面有url的一些地址;

希望對你有所幫助!!

B. php調用頁面div內的a標簽超鏈接

更改為:
preg_match_all('/<div class="fl item-r">(.*)<\/div>/isU',$return,$m);
preg_match_all('/<a href="(.*)"/isU',$m[1][0],$arr);
註:第一個正則匹配出來的$m是一個二維數組,你自己輸出便知。所以應該使用$m[1][0]來取出字元串<a>xxx</a>的內容。

C. 怎樣用PHP抓取整個網站的鏈接

$html = file_get_html('http://www.google.com/');
// Find all links
foreach($html->find('a') as $element)
echo $element->href . '<br>';
不知道你PHP支持不支持 file_get_html這個函數

但是像你說那樣的抓 肯定會超時的

D. 用PHP獲取鏈接及圖片路徑的方法

<?php

$str="Thisisatest.Thisisatest.Thisisa<ahref=http://link1.com><imgsrc=http://img1.jpg/></a>test.Thisisatest.Thisisatest. ".
"Thisisatest.Thisisatest.<ahref=http://link2.com><imgsrc=http://img2.jpg/></a>Thisisatest.Thisisatest.Thisisatest. ".
"<ahref=http://link3.com><imgsrc=http://img3.jpg/></a>";

$regex='/<as+href=(.*)s*><imgs+src=(.*)s*/></a>/';
$output=array();

if(preg_match_all($regex,$str,$matches)!==false){
if(isset($matches[1])&&isset($matches[2])){
$links=$matches[1];
$imgs=$matches[2];

foreach($linksas$key=>$link){
$img=isset($imgs[$key])?$imgs[$key]:'';
$output[]="<ahref="{$link}"><imgsrc="{$img}"/></a>";
}
}
}

var_mp($output);

E. 內容頁中,PHP如何獲得當前頁面的網址 帝國cms

用[!--titleurl--]模板變數即可獲取當前頁面的網址。

在帝國後台的內容模板里有一個「顯示模板變數說明」按鈕

希望能幫到你,謝謝。(我並沒有求採納之類的要求,說謝謝是我的個人修養問題。希望網路能修改相關規定。)

網路一方面要求相關性,一方面又說回答啰嗦,我也是醉了。還說含有相關性若的內容。。。呵呵,希望網路能換一些懂得這類問題的人來評估答案價值,不要再鬧這些笑話了,謝謝。

F. php正則獲取href的鏈接

使用正則中的子模式,按給出的代碼匹配的話大概是這樣

$pattern='/href="([^(}>)]+)"/';

然後使用preg_match或者preg_match_all如果替換的話使用preg_replace即可

G. PHP怎樣獲取全站鏈接

想獲取網站中的所有超鏈接,使用的是php snoopy類
$sourceURL = $url;
$snoopy->fetchlinks($sourceURL);
$content = $snoopy->results;

閱讀全文

與php獲取頁面所有鏈接相關的資料

熱點內容
怎樣關閉照片加密 瀏覽:520
文件夾變拉鏈 瀏覽:605
伺服器未在運行什麼意思 瀏覽:405
單片機應用大賽 瀏覽:462
博格上海壓縮機有限公司 瀏覽:27
招行車貸解壓有費用嗎 瀏覽:700
總統命令小說 瀏覽:818
安卓手機為什麼卡成狗 瀏覽:384
廣州市公司軟體加密 瀏覽:230
燈光設計手冊pdf 瀏覽:767
java虛線 瀏覽:428
androidio流 瀏覽:797
伺服器怎麼改nvr 瀏覽:937
真空壓縮袋怎樣打開 瀏覽:80
證券市場基礎知識pdf2012 瀏覽:720
mastercam自動編程視頻 瀏覽:9
如何得知加密類型 瀏覽:40
單片機匯編讓主程序循環執行 瀏覽:371
電訊APP是干什麼的 瀏覽:534
程序員互相之間不能透露薪水 瀏覽:974