This article mainly introduces the path problem in php and set_include_path. if you need it, refer to first:
Common paths in php
Current file path: D: \ phpweb \ php_example \ paide_path.php
The code is as follows:
1. dirname (_ FILE _); // output D: \ phpweb \ php_example
2. $ _ SERVER ['script _ filename']; // Output D:/phpweb/php_example/shortde_path.php
Second:
Set_include_path in php
In php, when the include file is included, when the include path is not relative or absolute (for example, include ("example. php "), the directory set by include_path will be searched first, and then searched in the current directory. This is why many documents mentioned include (". /example. php ") than include (" example. php ") causes of high efficiency.
Method:
1. ini_set ("include_path", "/usr/lib/pear"); // All versions
2. set_include_path ("/usr/lib/pear"); // version> = 4.3.0
You can use the following method to add a directory to the original directory.
The code is as follows:
$ Path = '/usr/lib/pear ';
Set_include_path (get_include_path (). PATH_SEPARATOR. $ path); // The set include_path is like/usr/lib/function;/usr/lib/pear
?>