PHP获取当前网址路径

$_SERVER['REQUEST_SCHEME'] . '://' . $_SERVER['HTTP_HOST'].$_SERVER['REQUEST_URI']

 

// 获取来源
function getClientUrl() {
    if (array_key_exists('HTTP_REFERER', $_SERVER)) {
        $origin = $_SERVER['HTTP_REFERER'];
    } elseif (array_key_exists('HTTP_ORIGIN', $_SERVER)) {
    $origin = $_SERVER['HTTP_ORIGIN'];
    } else {
        $origin = $_SERVER['REMOTE_ADDR'];
    }
    return $origin;
}

 

 
posted @ 2019-06-23 16:07  study_php_java_C++  阅读(3473)  评论(0编辑  收藏  举报