Home  >  Article  >  Backend Development  >  Path problem in php and set_include_path_PHP tutorial

Path problem in php and set_include_path_PHP tutorial

WBOY
WBOYOriginal
2016-07-13 10:39:00876browse

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:

www.bkjia.comtruehttp: //www.bkjia.com/PHPjc/733184.htmlTechArticleThis article mainly introduces the path problem and set_include_path in php. Friends who need it can refer to first:php Commonly used paths Current file path: D:phpwebphp_exampleinclude_pat...
Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn