The way PHP handles the ./ and ../ is totally counter
intuitive. As said if the included file is preceded by a ./
and ../ it looked up from the current working directory. And
that is defined by the of the EXECUTED script. That is the
script that you specified in the url.
So if your have a.php that includes include/b.php that
includes ../extern/c.php, it will not do what you want. You
can use extern/c.php instead if you never execute outside of
the document root. For me that just will not cut it. Since I
execute test suites if files are directly called, like in
python.
Here is my dirty trick that works, since I only have two
levels of file hierarchy:
set_include_path("../:./");
require_once("extern/c.php");
And here is an open question: Why are the included files not
looked up relative from the file that includes them and then
in the include path? This would be a behavior like in all
other languages.
----
Server IP: 217.13.201.10
Probable Submitter: 85.180.86.83
----
Manual Page -- htt
p://www.php.net/manual/en/function.include.php
Edit -- https://master
.php.net/note/edit/71446
Del: integrated -- h
ttps://master.php.net/note/delete/71446/integrated
Del: useless -- http
s://master.php.net/note/delete/71446/useless
Del: bad code -- htt
ps://master.php.net/note/delete/71446/bad+code
Del: spam -- https:/
/master.php.net/note/delete/71446/spam
Del: non-english --
https://master.php.net/note/delete/71446/non-english
Del: in docs -- http
s://master.php.net/note/delete/71446/in+docs
Del: other reasons-- https://mast
er.php.net/note/delete/71446
Reject -- https://mast
er.php.net/note/reject/71446
Search -- https://
master.php.net/manage/user-notes.php
--
PHP Notes Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub
.php
|