开发者

Why this php apache_request_headers doesn't work on IIS 7

开发者 https://www.devze.com 2023-03-13 00:01 出处:网络
This works on Apache, why it doesn\'t seem to work on IIS 7 ? if(!function_exists(\'apache_request_headers\')) {

This works on Apache, why it doesn't seem to work on IIS 7 ?

if(!function_exists('apache_request_headers')) {
    function apache_request_headers() {
        $headers = array();
        foreach($_SERVER as $key => $value) {
            if(substr($key, 0, 5) == 'HTTP_') {
                $headers[str_replace(' ', '-', ucwords(str_replace('_', ' ', strtolower(substr($key, 5)))))] = $value;
            }
        }
        return $headers;
    }
}

function getCurrentPageUrl() {
 $p开发者_StackOverflow中文版ageURL = 'http';
 if ($_SERVER["HTTPS"] == "on") {$pageURL .= "s";}
 $pageURL .= "://";
 if ($_SERVER["SERVER_PORT"] != "80") {
  $pageURL .= $_SERVER["SERVER_NAME"].":".$_SERVER["SERVER_PORT"].$_SERVER["REQUEST_URI"];
 } else {
  $pageURL .= $_SERVER["SERVER_NAME"].$_SERVER["REQUEST_URI"];
 }
 return $pageURL;
}    

$a =  apache_request_headers();

$pos = strrpos($a["User-Agent"], "REBOL");


It's Apache specific, looking at the Docs.

http://php.net/manual/en/function.apache-request-headers.php

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号