Home > Backend Development > PHP Tutorial > PHP function to get the current complete URL address, php gets the current url_PHP tutorial

PHP function to get the current complete URL address, php gets the current url_PHP tutorial

WBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWB
Release: 2016-07-13 10:11:13
Original
1115 people have browsed it

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;
}

www.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...
Related labels:
php
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Latest Issues
php data acquisition?
From 1970-01-01 08:00:00
0
0
0
PHP extension intl
From 1970-01-01 08:00:00
0
0
0
How to learn php well
From 1970-01-01 08:00:00
0
0
0
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template