PHP获取当前url

2019-08-11  本文已影响0人  chagunzha

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;

}

上一篇 下一篇

猜你喜欢

热点阅读