函数apache_lookup_uri()
描述:
Perform a partial request for the specified URI and return all info about it,This performs a partial request for a URI. It goes just far enough to obtain all the important information about the given resource and returns this information in a class. The properties of the returned class are:
status:the_request、status_line、method、content_type、handler
uri:filename、path_info、args、boundary、no_cache、no_local_copy、 allowed、send_bodyct、bytes_sent、byterange、clength、unparsed_uri mtime、request_time
函数apache_note()
描述:
Get and set apache request notes,apache_note() is an Apache-specific function which gets and sets values in a request's notes table. If called with one argument, it returns the current value of note note_name . If called with two arguments, it sets the value of note note_name to note_value and returns the previous value of note note_name .
函数getallheaders()
描述:
Fetch all HTTP request headers(取得所有HTTP头部请求)
例子:
$headers = getallheaders();
while (list($header, $value) = each($headers)) {
echo "$header: $value
\n";
}
这个例子将显示返回所有最近的头部请求。
注:此函数只支持APACHE下的PHP
函数virtual()
描述:
virtual() is an Apache-specific function which is equivalent to in mod_include. It performs an Apache sub-request. It is useful for including CGI scripts or .shtml files, or anything else that you would parse through Apache. Note that for a CGI script, the script must generate valid CGI headers. At the minimum that means it must generate a Content-type header.
数组函数
函数array()
描述:
建立一个数组
array array(...)传回一数组的值,这些值可以用=>来附值。
下面说明了如何构建一个二维数组,及如何指定这个数组的key,以及在正常的数组中以跳序的方式去指定数组的值。
Example 1. array() example
$fruits = array(
"fruits" => array("a"=>"orange","b"=>"banana","c"=>"apple"),
"numbers" => array(1, 2, 3, 4, 5, 6),
"holes" => array("first", 5 => "second", "third")
);
函数array_walk()
描述:
用函数的方式对每个数组的元素做处理
int array_walk (array arr, string func);
使用一个叫FUNC的函数对ARR的每个元素做处理,那些元素将当成是首传给FUNC的参数;如果FUNC需要超过一个参数,则在每次array_walk()呼叫FUNC时都产生一个警告信息,这些警告信息是可以消除的,只要把'@'符号加在array_walk()之前即可。
注意:FUNC会直接对ARR中的元素做处理,所以任何元素的变化将直接改变其在数组中的值。
Example 1. array_walk() example
$fruits = array("d"=>"lemon","a"=>"orange","b"=>"banana","c"=>"apple");
function test_alter( $item1 ) { $item1 = 'bogus'; }
function test_print( $item2 ) { echo "$item2
\n"; }
array_walk( $fruits, 'test_print' );
array_walk( $fruits, 'test_alter' );
array_walk( $fruits, 'test_print' );
函数arsort()
描述:
以倒序的方式排列一数组但其序数则不变
void arsort (array array);
This function sorts an array such that array indices maintain their correlation with the array elements they are associated with. This is used mainly when sorting associative arrays where the actual element order is significant. Example 1. arsort() example
$fruits = array("d"=>"lemon","a"=>"orange","b"=>"banana","c"=>"apple");
arsort($fruits);
for(reset($fruits); $key = key($fruits); next($fruits)) {
echo "fruits[$key] = ".$fruits[$key]."\n";
}
This example would display: fruits[a] = orange fruits[d] = lemon fruits[b] = banana fruits[c] = apple The fruits have been sorted in reverse alphabetical order, and the index associated with each element has been maintained.
函数asort()
描述:
顺序排列一数组且其序数不变
void asort (array array);
This function sorts an array such that array indices maintain their correlation with the array elements they are associated with. This is used mainly when sorting associative arrays where the actual element order is significant. Example 1. asort() example
$fruits = array("d"=>"lemon","a"=>"orange","b"=>"banana","c"=>"apple");
asort($fruits);
for(reset($fruits); $key = key($fruits); next($fruits)) {
echo "fruits[$key] = ".$fruits[$key]."\n";
}
This example would display: fruits[c] = apple fruits[b] = banana fruits[d] = lemon fruits[a] = orange The fruits have been sorted in alphabetical order, and the index associated with each element has been maintained.