note 48391 added to function.include
| From: | patrick_allaert at pandora dot be | Date: | Wed, 22 Dec 2004 01:15:21 +0000 |
| Subject: | note 48391 added to function.include | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-82147@lists.php.net to get a copy of this message | ||
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
----
Manual Page -- http://www.php.net/manual/en/function.include.php
Edit -- http://master.php.net/manage/user-notes.php?action=edit+48391
Delete -- http://master.php.net/manage/user-notes.php?action=delete+48391&report=yes
Reason: bad code -- http://master.php.net/manage/user-notes.php?action=delete+48391&report=yes&reason=bad+code
Reason: spam -- http://master.php.net/manage/user-notes.php?action=delete+48391&report=yes&reason=spam
Reason: useless example -- http://master.php.net/manage/user-notes.php?action=delete+48391&report=yes&reason=useless+example
Reason: contains commercial links -- http://master.php.net/manage/user-notes.php?action=delete+48391&report=yes&reason=contains+commercial+links
Reason: useless note -- http://master.php.net/manage/user-notes.php?action=delete+48391&report=yes&reason=useless+note
Reject -- http://master.php.net/manage/user-notes.php?action=reject+48391&report=yes
Search -- http://master.php.net/manage/user-notes.php