PHP - Manual: nsapi_request_headers
2024-11-15
(PHP 4 >= 4.3.3, PHP 5, PHP 7)
nsapi_request_headers — Fetch all HTTP request headers
nsapi_request_headers() gets all the HTTP headers in the current request. This is only supported when PHP runs as a NSAPI module.
Note:
Prior to PHP 4.3.3, getallheaders() was only available for the Apache servers. After PHP 4.3.3, getallheaders() is an alias for nsapi_request_headers() if you use the NSAPI module.
Note:
You can also get at the value of the common CGI variables by reading them from the $_SERVER superglobal, which works whether or not you are using PHP as a NSAPI module.
Returns an associative array with all the HTTP headers.
Example #1 nsapi_request_headers() example
<?php
$headers = nsapi_request_headers();
foreach ($headers as $header => $value) {
echo "$header: $value <br />\n";
}
?>
官方地址:https://www.php.net/manual/en/function.nsapi-request-headers.php