zoukankan      html  css  js  c++  java
  • php获取当前浏览器完整地址

    /**
     * 获取当前页面完整URL地址
     */
    function get_url() {
        $sys_protocal = isset($_SERVER['SERVER_PORT']) && $_SERVER['SERVER_PORT'] == '443' ? 'https://' : 'http://';
        $php_self = $_SERVER['PHP_SELF'] ? $_SERVER['PHP_SELF'] : $_SERVER['SCRIPT_NAME'];
        $path_info = isset($_SERVER['PATH_INFO']) ? $_SERVER['PATH_INFO'] : '';
        $relate_url = isset($_SERVER['REQUEST_URI']) ? $_SERVER['REQUEST_URI'] : $php_self.(isset($_SERVER['QUERY_STRING']) ? '?'.$_SERVER['QUERY_STRING'] : $path_info);
        return $sys_protocal.(isset($_SERVER['HTTP_HOST']) ? $_SERVER['HTTP_HOST'] : '').$relate_url;
    }
    
    echo get_url();
  • 相关阅读:
    uva-11129-分治
    HDU 6016
    POJ 2142
    CodeForces 778B
    CodeFroces 758C
    HDU 5900
    HDU 5903
    HDU 5904
    POJ 3080
    HDU 5195
  • 原文地址:https://www.cnblogs.com/chenjiacheng/p/6522607.html
Copyright © 2011-2022 走看看