What is the "Starting Point" for PHP set_include_path

What is set_include_path Relatively in PHP? Is this the folder where PHP.exe is located? Is this a web router? In other words, which folder will set_include_path ('/') or set_include_path ('.') Link to?

+3
source share
4 answers

Relative paths are resolved from the file location where includeanother function is used that uses include_path (see the description of include_path ):

. include , . , include './file', PHP include.

/ . .

+2

.

+1

set_include_path ( "/" ) include , , , , , , t , .

If your php file was /home/users/joebloggs/htmlroot/index.php, then set_include_path (".") Will make the include path the directory where the php file is located, that is, the htmlroot directory.

+1
source

On * nix and Windows systems, Apache / is the root of the file system. While on IIS / points to the root of vhost.

What I am doing for this is to define the LOC constant in my index.php so that I never get confused when I include the files.

define('LOC', dirname(__FILE__));
include(LOC . '/files/file.php');
0
source

Source: https://habr.com/ru/post/1731049/


All Articles