PHP确定当前URL [英] PHP Determining the current url
本文介绍了PHP确定当前URL的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我需要修改函数以返回当前所在的文件夹。这是我的当前函数:
I need to modify my function to return also the current folder I am in. Here is my current function:
function getLinkFromHost($url){
$port = $_SERVER['REMOTE_PORT'];
$server = $_SERVER['HTTP_HOST'];
if($port == 443){
$type = "https";
} else {
$type = "http";
}
return $type . "://" . $server . "/" . $url;
}
推荐答案
看看 $ _ SERVER ['REQUEST_URI']
或 $ _ SERVER ['SCRIPT_NAME']
(从 $ _ SERVER
手动输入)
(From the $_SERVER
manual entry)
这篇关于PHP确定当前URL的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文