object apache_lookup_uri ( string $filename )
(PHP 4, PHP 5)

이 함수는 PHP를 아파치 모듈과 연동하였을 때만 작동합니다. 그리고 주어진 인자에 파일명 (URI)에 대한 정보, 헤더 정보를 다음 표의 값을 Object로 반환합니다.

객체명
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

<?php
 $info = apache_lookup_uri('index.php?var=value&key=tempo');
 print_r($info);
 /*
 결과:
 stdClass Object
 (
    [status] => 200
    [the_request] => GET /test.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] => /index.php?var=value&key=tempo
    [uri] => /index.php
    [filename] => /host/html/index.php
    [args] => var=value&key=tempo
    [allowed] => 0
    [sent_bodyct] => 0
    [bytes_sent] => 0
    [request_time] => 1307537760
 )
 */
 ?>

<?php
 $info = apache_lookup_uri('test.php');
 if(file_exists($info->filename)){
      echo "실제 존재하는 파일입니다.";
 }
 ?>

<?php
 $info = apache_lookup_uri('test.php');
 if($info->method === "GET"){
      echo "이 파일은 GET으로 접속하였습니다.";
 }
 ?> 

0 댓글