Single

PHP获取当前页面URL

function getUrl() {
  $url  = @( $_SERVER["HTTPS"] != 'on' ) ? 'http://'.$_SERVER["SERVER_NAME"] :  'https://'.$_SERVER["SERVER_NAME"];
  $url .= ( $_SERVER["SERVER_PORT"] !== 80 ) ? ":".$_SERVER["SERVER_PORT"] : "";
  $url .= $_SERVER["REQUEST_URI"];
  return $url;
}

文章有(13)条网友点评

  • Outstanding quest there. What occurred after?

    Thanks!

  • 打打打打

  • Hey! I could have sworn I’ve been to this site before but after reading
    through some of the post I realized it’s new to me.
    Anyways, I’m definitely glad I found it and I’ll be book-marking and checking back often!

  • 测试

  • 回到顶部,那个按钮图在手机移动端的位置不正确,右上角把菜单都遮住了,样式有问题。你的网站。

  • 支持

  • 意外发现了这么个网站,感觉恋爱了

    • @小橘猫 ….

      • @专收爆米花 唉,可惜这不符合我,我不会PHP

  • 判断 SERVER_PORT 就可以知道是不是 https 请求了

  • 拿小本本记下来!

  • 哇哦

发表评论