note 32804 added to function.include
| From: | lordwo_NOSPAM_ at laposte_NOBOTS_ dot net | Date: | Sat, 07 Jun 2003 17:27:35 +0000 |
| Subject: | note 32804 added to function.include | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-49944@lists.php.net to get a copy of this message | ||
Let's define some terms:
/index.php
========
require("somewhere/included.php");
/somewhere/included.php
=========
require("second.php");
/second.php
=========
echo "hello world !";
The problem is the following: on windows system, with PHP 4.3.0, if you call included.php from
somewhere different of "/", you will get a warning/error.
A solution was told before, but wasn't clear enough for me, so I'm trying to re-explain
this.
Put absolute-path is generally not a bad idea, so we will use what I call 'semi-absolute
path' using the __FILE__ constant.
For each of your include(), do as following:
include(dirname(__FILE__) ."\\..\bla\bla");
This is supposed to be equivalent to ".\..\bla\bla", but in fact it's NOT.
The solution to our problem, is to put
require(dirname(__FILE__) . "\..\second.php");
to avoid any problem when calling the script.
Hope this helps
----
Manual Page -- http://www.php.net/manual/en/function.include.php
Edit Note -- http://master.php.net/manage/user-notes.php?action=edit+32804
Delete Note -- http://master.php.net/manage/user-notes.php?action=delete+32804&report=yes
Reject Note -- http://master.php.net/manage/user-notes.php?action=reject+32804&report=yes