This article mainly introduces the path problem and set_include_path in php. Friends in need can refer to it
first: Commonly used paths in php Current file path: D:phpwebphp_exampleinclude_path.php The code is as follows: 1.dirname(__FILE__); //Output D:phpwebphp_example 2.$_SERVER['SCRIPT_FILENAME']; //Output D:/phpweb/php_example/include_path.php second: set_include_path in php In PHP, when including a file, when the include path is neither relative nor absolute (such as: include("example.php")), the directory set by include_path will be searched first, and then searched in the current directory. This is also A lot of information mentions the reason why include("./example.php") is more efficient than include("example.php"). 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: