首页 > php教程 > php手册 > 正文

PHP获取当前页面的网址,php获取当前页

WBOY
发布: 2016-06-13 09:16:53
原创
1717 人浏览过

PHP获取当前页面的网址,php获取当前页

PHP获取当前页面的网址

<span>function</span><span> GetCurUrl()
{
  </span><span>$url </span>= 'http://'<span>;

  </span><span>if</span>(<span>isset</span>(<span>$_SERVER</span>['HTTPS']) AND <span>$_SERVER</span>['HTTPS'] == 'on'<span>)
  {
    </span><span>$url</span> = 'https://'<span>;
  }

  </span><span>if</span>(<span>$_SERVER</span>['SERVER_PORT'] != '80'<span>)
  {
    </span><span>$url</span> .= <span>$_SERVER</span>['HTTP_HOST'].':'.<span>$_SERVER</span>['SERVER_PORT'].<span>$_SERVER</span>['REQUEST_URI'<span>];
  }
  </span><span>else</span><span>
  {
    </span><span>$url</span> .= <span>$_SERVER</span>['HTTP_HOST'].<span>$_SERVER</span>['REQUEST_URI'<span>];
  }
  </span><span>return</span> <span>$url</span><span>;
}</span>
登录后复制

 

相关标签:
php
来源:php.cn
本站声明
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系admin@php.cn
热门推荐
热门教程
更多>
最新下载
更多>
网站特效
网站源码
网站素材
前端模板