请知悉:本文最近一次更新为 9年 前,文中内容可能已经过时。

Apache 服务器可以通过如下获取:

<?php
$headers = Apache_request_headers();
foreach ($headers as $header => $value) {
echo "$header: $value <br />n";
}

其他服务环境:

<?php
function parseRequestHeaders() {
$headers = array();
foreach($_SERVER as $key => $value) {
if (substr($key, 0, 5) <> 'HTTP_') {
continue;
}
$header = str_replace(' ', '-', ucwords(str_replace('_', ' ', strtolower(substr($key, 5)))));
$headers[$header] = $value;
}
return $headers;
}

整理自:https://stackoverflow.com/questions/541430/how-do-i-read-any-request-header-in-php


如您从本文得到了有价值的信息或帮助,请考虑扫描文末二维码捐赠和鼓励。

尊重他人劳动成果。转载请务必附上原文链接,我将感激不尽。


与《PHP-提取访问者headers》相关的博文:


发布时间 11/26/2014 09:52:01栏目 Software.标签 .

留言

avatar
😀
😀😁😂😅😭🤭😋😘🤔😰😱🤪💪👍👎🤝🌹👌