NSAPI implements a subset of the functions from the Apache module for maximum compatibility.

Apache function (only as alias)NSAPI functionDescription
apache_request_headersnsapi_request_headersFetch all HTTP request headers
apache_response_headersnsapi_response_headersFetch all HTTP response headers
getallheadersnsapi_request_headersFetch all HTTP request headers
virtualnsapi_virtualMake NSAPI sub-request

nsapi_request_headers

Fetch all HTTP request headers

说明

array nsapi_request_headers ( 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 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 $_SERVER superglobal, 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 nsapi_response_headers ( 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 nsapi_virtual ( 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 include or require.

Note:

This function depends on a undocumented feature of the Netscape/iPlanet/Sun webservers. Use 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.dll file.

Read the note about subrequests in the NSAPI section (UNIX, Windows) if you experience this problem.

参数

uri
The URI of the script.

返回值

成功时返回 TRUE, 或者在失败时返回 FALSE

目录