Set_include_path and get_include_path usage and precautions. Set_include_path: when setting the default include path in the include or require file, first find the default include path, and then find the example in the same directory: D: xampphtdocstestinclude. set_include_path sets the default include path.
Find the include or require file in the default include path and then in the same directory
Example:
D:/xampp/htdocs/test/include has a file named cls. mysqli. php.
D:/xampp/htdocs/test/has a file named set_include_path.php.
The content is
The code is as follows:
Set_include_path ('/xampp/htdocs/test/include'); // note that '/' in php indicates not the root directory of the website, but the drive letter of the file, available echo realpath ('/'); view
// If the php version is too low, this function is not supported and can be used in the general version of ini_set ()
/* View the actual default include path */
Echo realpath (get_include_path ());
/* To include cls. mysqli. php, you only need */
Require_once ('cls. mysqli. php ');
$ Mysql = new Mysql ('localhost', 'root', '', 'test'); // The instantiated and subsequent query statements are correct.
Http://www.bkjia.com/PHPjc/326493.htmlwww.bkjia.comtruehttp://www.bkjia.com/PHPjc/326493.htmlTechArticleset_include_path settings default include path in the include or require file, first find in the default include path, then look for example in the same directory: D: there is an article under/xampp/htdocs/test/include...