獲取帝國CMS路徑方法1
=$url_this?>
獲取帝國CMS路徑方法2
=$url_this?>
PHP實現(xiàn)獲取當前頁面的完整地址
測試網(wǎng)址:?https://www.ebingou.cn/showinfo-34-4035-0.html
//獲取域名或主機地址
echo?$_SERVER?['HTTP_HOST']."
";?#??www.ebingou.cn
//獲取網(wǎng)頁地址
echo?$_SERVER?['PHP_SELF']."
";?#?/e/action/ShowInfo.php
//獲取網(wǎng)址參數(shù)
echo?$_SERVER?["QUERY_STRING"]."
";?#?classid=34&id=4035&page=0
//獲取用戶代理
echo?$_SERVER?['HTTP_REFERER']."
";
//?獲取完整的url
echo?'http://'.?$_SERVER?['HTTP_HOST'].?$_SERVER?['REQUEST_URI'];
echo?'http://'.?$_SERVER?['HTTP_HOST'].?$_SERVER?['PHP_SELF'].'?'.?$_SERVER?['QUERY_STRING'];
#https://www.ebingou.cn/showinfo-34-4035-0.html
#?https://www.ebingou.cn/e/action/ShowInfo.php?classid=34&id=4035&page=0
//包含端口號的完整url
echo?'http://'.?$_SERVER?['SERVER_NAME'].':'.?$_SERVER?["SERVER_PORT"].?$_SERVER?["REQUEST_URI"];
#?http://wdzzz.com:80/showinfo-34-4035-0.html
//只取路徑
$url?='http://'.?$_SERVER?['SERVER_NAME'].?$_SERVER?["REQUEST_URI"];
echo?dirname?(?$url?);
#?http://wdzzz.com
?>
版權聲明: 本站資源均來自互聯(lián)網(wǎng)或會員發(fā)布,如果侵犯了您的權益請與我們聯(lián)系,我們將在24小時內刪除!謝謝!
轉載請注明: php獲取帝國CMS各種路徑的幾種寫法