how to get the absolute path of an included file?
| From: | Bing Du | Date: | Thu, 27 Apr 2006 14:19:27 +0000 |
| Subject: | how to get the absolute path of an included file? | ||
| Groups: | php.general | ||
| Request: | Send a blank email to php-general+get-234925@lists.php.net to get a copy of this message | ||
Hello,
Here are the two scripts. The result is 'var is' rather than 'var is
foo'. My suspect is I did not set the file path right in 'include'. So
in file2.php, how should I get the actual absolute path it really gets for
file1.php? Is it stored in some environment variable or something? I'd
appreciate any help.
file1.php
==
<?php
$var = 'foo';
?>
==
file2.php
==
<?php
include '/some/path/file1.php';
echo "var is $var";
?>
==
Thanks,
Bing