美文网首页
PHP获取当前url

PHP获取当前url

作者: chagunzha | 来源:发表于2019-08-11 08:40 被阅读0次

function getCurrentUrl() {

    $protocol = (!empty($_SERVER['HTTPS']) && $_SERVER['HTTPS'] !== 'off' || $_SERVER['SERVER_PORT'] == 443) ? "https://" : "http://";

    $url = $protocol.$_SERVER['HTTP_HOST'].$_SERVER['REQUEST_URI'];

    return $url;

}

相关文章

网友评论

      本文标题:PHP获取当前url

      本文链接:https://www.haomeiwen.com/subject/rldjjctx.html