(PHP 4, PHP 5, PHP 7, PHP 8)
apache_lookup_uri — 對(duì)指定的 URI 執(zhí)行部分請(qǐng)求并返回所有有關(guān)信息
$filename): object|false本函數(shù)對(duì)一個(gè) URL 執(zhí)行部分請(qǐng)求。取得所有有關(guān)給定資源的重要信息后就停手。
僅在 PHP 以 Apache 模塊運(yùn)行時(shí),才支持此函數(shù)。
filename被請(qǐng)求的文件名(URI)。
一個(gè)有關(guān) URI 信息的 object。此 object 的屬性有:
失敗時(shí)返回 false。
示例 #1 apache_lookup_uri() 例子
<?php
$info = apache_lookup_uri('index.php?var=value');
print_r($info);
if (file_exists($info->filename)) {
echo 'file exists!';
}
?>
以上例程的輸出類似于:
stdClass Object
(
[status] => 200
[the_request] => GET /dir/file.php HTTP/1.1
[method] => GET
[mtime] => 0
[clength] => 0
[chunked] => 0
[content_type] => application/x-httpd-php
[no_cache] => 0
[no_local_copy] => 1
[unparsed_uri] => /dir/index.php?var=value
[uri] => /dir/index.php
[filename] => /home/htdocs/dir/index.php
[args] => var=value
[allowed] => 0
[sent_bodyct] => 0
[bytes_sent] => 0
[request_time] => 1074282764
)
file exists!