Home >php教程 >php手册 >PHP获取当前页面完整URL地址函数

PHP获取当前页面完整URL地址函数

WBOY
WBOYOriginal
2016-06-07 11:42:011359browse

PHP获取当前页面完整URL地址函数
 <?php <br /> /**<br>  * 获取当前页面完整URL地址<br>  */<br> function get_url() {<br>     $sys_protocal = isset($_SERVER['SERVER_PORT']) && $_SERVER['SERVER_PORT'] == '443' ? 'https://' : 'http://';<br>     $php_self = $_SERVER['PHP_SELF'] ? $_SERVER['PHP_SELF'] : $_SERVER['SCRIPT_NAME'];<br>     $path_info = isset($_SERVER['PATH_INFO']) ? $_SERVER['PATH_INFO'] : '';<br>     $relate_url = isset($_SERVER['REQUEST_URI']) ? $_SERVER['REQUEST_URI'] : $php_self.(isset($_SERVER['QUERY_STRING']) ? '?'.$_SERVER['QUERY_STRING'] : $path_info);<br>     return $sys_protocal.(isset($_SERVER['HTTP_HOST']) ? $_SERVER['HTTP_HOST'] : '').$relate_url;<br> }<br>  <br> echo get_url();<br> ?>

AD:真正免费,域名+虚机+企业邮箱=0元

Statement:
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
Previous article:js验证身份证类Next article:3.2版七牛云存储文件