Ref/nsapi-Phpdoc专题
NSAPI implements a subset of the functions from the Apache module for maximum compatibility.
| Apache function (only as alias) | NSAPI function | Description |
|---|---|---|
| apache_request_headers | nsapi_request_headers | Fetch all HTTP request headers |
| apache_response_headers | nsapi_response_headers | Fetch all HTTP response headers |
| getallheaders | nsapi_request_headers | Fetch all HTTP request headers |
| virtual | nsapi_virtual | Make NSAPI sub-request |
nsapi_request_headers
Fetch all HTTP request headers
说明
array <span class="methodname">nsapi_request_headers ( <span class="methodparam">void )
nsapi_request_headers gets all the HTTP headers in the current request. This is only supported when PHP runs as a NSAPI module.
Note:
getallheaders is an alias for <span class="function">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
$_SERVERsuperglobal, which works whether or not you are using PHP as a NSAPI module.
返回值
Returns an associative array with all the HTTP headers.
范例
示例 #1 nsapi_request_headers example
<?php
$headers = nsapi_request_headers();
foreach ($headers as $header => $value) {
echo "$header: $value <br />\n";
}
?>
nsapi_response_headers
Fetch all HTTP response headers
说明
array <span class="methodname">nsapi_response_headers ( <span class="methodparam">void )
Gets all the NSAPI response headers.
返回值
Returns an associative array with all the NSAPI response headers.
参见
- nsapi_request_headers
- headers_sent
nsapi_virtual
Perform an NSAPI sub-request
说明
bool <span
class="methodname">nsapi_virtual ( <span
class="methodparam">string $uri )
nsapi_virtual is an NSAPI-specific
function which is equivalent to \<!--#include virtual...--> in SSI
(.shtml files). It does an NSAPI sub-request. It is useful for
including CGI scripts or .shtml files, or anything else that you'd parse
through webserver.
To run the sub-request, all buffers are terminated and flushed to the browser, pending headers are sent too.
You cannot make recursive requests with this function to other PHP scripts. If you want to include PHP scripts, use <span class="function">include or <span class="function">require.
Note:
This function depends on a undocumented feature of the Netscape/iPlanet/Sun webservers. Use <span class="function">phpinfo to determine if it is available. In the Unix environment it should always work, in Windows it depends on the name of a
ns-httpdXX.dllfile.Read the note about subrequests in the NSAPI section (UNIX, Windows) if you experience this problem.
参数
uri
The URI of the script.
返回值
成功时返回 true, 或者在失败时返回 false。
目录
- nsapi_request_headers — Fetch all HTTP request headers
- nsapi_response_headers — Fetch all HTTP response headers
- nsapi_virtual — Perform an NSAPI sub-request