Hello! 欢迎来到盒子萌!

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;
}

  • avatar
    游客

    Outstanding quest there. What occurred after?

    Thanks!

  • avatar
    游客

    打打打打

  • avatar
    游客

    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!

  • avatar
    游客

    测试

  • avatar
    游客

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

  • avatar
    游客

    支持

  • avatar
    游客

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

    • avatar
      博主

      @ 小橘猫 ….

      • avatar
        游客

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

  • avatar
    游客

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

  • avatar
    游客

    拿小本本记下来!

  • avatar
    游客

    哇哦

发表评论

相关阅读