|
apache_lookup_uri
Perform a partial request for the specified URI and return all info about it
(PHP 4, PHP 5)
This performs a partial request for a URI. It goes just far enough to obtain all the important information about the given resource. This function is only supported when PHP is installed as an Apache module. Return ValuesAn object of related URI information. The properties of this object are:
ExamplesExample 204. apache_lookup_uri() example<?php The above example will output something similar to: stdClass Object Code Examples / Notes » apache_lookup_uritrejkaz
Apparently on PHP 4.2, this function returns an array instead of an object. That being the case, the example code above would translate to: <?php $info = apache_lookup_uri('index.php?var=value'); print_r($info); if (file_exists($info['filename'])) { echo 'file exists!'; } ?> A means of making this transparent so that the object syntax works, is left as an exercise for the reader. ;-) redbeard
A useful feature is that if you have content negotiation on (Options MultiViews) Apache will resolve the negotiation for you if possible. Thus www.example.com/blah will resolve to /base/blah.php or /base/blah.html or even /base/blah.en.html as appropriate.
|