无法获取http请求头信息 getallheaders()、apache_get_version()等一系列函数无效
if (!function_exists('getallheaders')) {
function getallheaders() {
$headers = array();
foreach ($_SERVER as $name => $value) {
if (substr($name, 0, 5) == 'HTTP_') {
$headers[str_replace(' ', '-', ucwords(strtolower(str_replace('_', ' ', substr($name, 5)))))] = $value;
}
}
return $headers;
}
}
$header = getallheaders();
if(empty($header)){
return $this->createErrorResponse('请求头中参数缺失');
}
$token = $header['Authorization'];