一、发送请求头

二、接收并打印请求头

JavaScript
8 行
$headers = array();
foreach ($_SERVER as $key => $value) {
    if ('HTTP_' == substr($key, 0, 5)) {
        $headers[str_replace('_', '-', substr($key, 5))] = $value;
    }
}    
echo '<pre>';
print_r($headers);