Apache 함수 apache_lookup_uri

(PHP 4, PHP 5, PHP 7, PHP 8)

apache_lookup_uri — 지정된 URI에 대한 부분 요청을 수행하고 이에 대한 모든 정보를 반환합니다.


설명

apache_lookup_uri(string $filename): object|false

이것은 URI에 대한 부분 요청을 수행합니다. 주어진 자원에 대한 모든 중요한 정보를 얻기에 충분합니다.

이 함수는 PHP가 Apache 모듈 웹서버로 설치된 경우에 지원됩니다.


매개변수

filename
요청 중인 파일 이름(URI)입니다.

반환 값

관련 URI 정보의 개체입니다. 이 개체의 속성은 다음과 같습니다.

  • status
  • the_request
  • status_line
  • method
  • content_type
  • handler
  • ri
  • filename
  • path_info
  • args
  • boundary
  • no_cache
  • no_local_copy
  • allowed
  • send_bodyct
  • bytes_sent
  • byterange
  • clength
  • unparsed_uri
  • mtime
  • request_time

실패 시 false를 반환합니다.


Examples

예제 #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!