note 48391 deleted from function.include by tularis
| From: | tularis@php.net | Date: | Wed, 22 Dec 2004 08:23:34 +0000 |
| Subject: | note 48391 deleted from function.include by tularis | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-82162@lists.php.net to get a copy of this message | ||
Note Submitter: patrick_allaert at pandora dot be
----
Removing the "." (dot) from the include_path and always including scripts as
"./script.php" is an optimisation as said Rasmus...
But be careful that relative includes does not always work as expected...
Example:
/a.php
/folder/b.php
/folder/c.php
--- /a.php ---
<?php
include_once('./folder/b.php');
?>
--- /folder/b.php ---
<?php
include_once('./c.php');
?>
--- /folder/c.php ---
<?php
echo 'From c.php';
?>
http://localhost/folder/b.php => display "From
c.php"
http://localhost/a.php => don't !!
The reason is that relative paths are interpreted from the requested script (here: /a.php)!
Patrick Allaert
----
Reason: bad code