首頁 >後端開發 >php教程 >PHP获取当前页面的网址,php获取当前页_PHP教程

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

WBOY
WBOY原創
2016-07-13 10:09:231249瀏覽

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>

 

www.bkjia.comtruehttp://www.bkjia.com/PHPjc/946201.htmlTechArticlePHP获取当前页面的网址,php获取当前页 PHP获取当前页面的网址 function GetCurUrl(){ $url = 'http://' ; if ( isset ( $_SERVER ['HTTPS']) AND $_SERVER ['HTTPS']...
陳述:
本文內容由網友自願投稿,版權歸原作者所有。本站不承擔相應的法律責任。如發現涉嫌抄襲或侵權的內容,請聯絡admin@php.cn