RE: [PHP] $SCRIPT_FILENAME
| From: | Marc Burgauer | Date: | Thu, 07 Sep 2000 13:52:07 +0000 |
| Subject: | RE: [PHP] $SCRIPT_FILENAME | ||
| Groups: | php.general | ||
| Request: | Send a blank email to php-general+get-15709@lists.php.net to get a copy of this message | ||
I have all my script files in a certain directory structure. I also have a
file I include in all my scripts (actually by using the prepend option in
php.ini) where I assign these paths to variables like this:
$all_sql_files = "/home/php_scripts/sql/";
$all_user_files = "/home/php_scripts/users/";
etc. ...
When I need to reference a certain file in a script, I can use the variables
to build the path for it. Also this way I can move the script directory
around without having to ever change any scripts, just the file containing
the paths.
I am not aware that PHP gives you the option to search for a file in your
directories and return its path other then to used a shell command and parse
it's output. On Unix that could be:
cd /
find . -name filename.extension -print
The first line takes you to the top of the directory tree.
HTH
Marc
> -----Original Message-----
> From: Bård Farstad [SMTP:bf@ez.no]
> Sent: Thursday, September 07, 2000 2:44 PM
> To: php-general@lists.php.net
> Subject: [PHP] $SCRIPT_FILENAME
>
> Hi all,
>
> I want to get the full path of a script which I have included. I use this
> in
> a class and would like for it to know it's full path.
>
> is this possible?
>
> eg:
>
> file1.php
> <?
> include( "/some/path/file2.php");
> ?>
>
> file2.php
> <?
> print( "file2.php is located at: " . $MY_FULL_PATH );
> ?>
>
> --bård
>
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, e-mail: php-general-unsubscribe@lists.php.net
> For additional commands, e-mail: php-general-help@lists.php.net
> To contact the list administrators, e-mail: php-list-admin@lists.php.net
>