php取得当前页面完整url

180it 2020-02-19 PM 193℃ 0条
<?php
  /**
   * 取得当前页面完整url
   */
function geturl() {
    $url = '';
    if (isset ( $_SERVER ['REQUEST_URI'] )) {
      $url = $_SERVER ['REQUEST_URI'];
    } else {
      $url = $_SERVER ['Php_SELF'];
      $url .= empty ( $_SERVER ['QUERY_STRING'] ) ? '' : '?' . $_SERVER ['QUERY_STRING'];
    }
    return $url;
  }

echo geturl();
?>
支付宝打赏支付宝打赏 微信打赏微信打赏

如果文章或资源对您有帮助,欢迎打赏作者。一路走来,感谢有您!

标签: none

php取得当前页面完整url