PHP function to get the current complete URL address, php to get the current url
Here is mainly to share with you a very practical PHP function. The code is very simple, so no more nonsense. If you need it, you can use it directly.
Copy code The code is as follows:
//php gets the complete url address of the current visit
function get_current_url(){
$current_url='http://';
If(isset($_SERVER['HTTPS'])&&$_SERVER['HTTPS']=='on'){
$current_url='https://';
}
If($_SERVER['SERVER_PORT']!='80'){
$current_url.=$_SERVER['SERVER_NAME'].':'.$_SERVER['SERVER_PORT'].$_SERVER['REQUEST_URI'];
}else{
$current_url.=$_SERVER['SERVER_NAME'].$_SERVER['REQUEST_URI'];
}
Return $current_url;
}
http://www.bkjia.com/PHPjc/930487.htmlwww.bkjia.comtruehttp: //www.bkjia.com/PHPjc/930487.htmlTechArticlePHP function to get the current complete URL address, php to get the current url. This is mainly to share with you a very practical PHP Function, the code is very simple, no more nonsense, what friends need...