set_include_path sets the default include path
When you include or require a file, first look for it in the default include path, and then look for it in the same directory
Example:
D:/xampp/htdocs/test/include There is one below The file is cls.mysqli.php
D:/xampp/htdocs/test/ There is a file under set_include_path.php
The content inside is
Copy code The code is as follows:
set_include_path('/xampp/htdocs/test/include'); //Please note that the '/' in php does not represent the root directory of the website, but the location of the file drive letter, you can use echo realpath('/'); to view
//If the PHP version is too low, this function is not supported, you can use the general version ini_set()
/*View the real default include path*/
echo realpath(get_include_path());
/*To include cls.mysqli.php just*/
require_once('cls.mysqli.php');
$mysql = new Mysql('localhost ','root','','test'); //There are no errors in instantiation and subsequent query statements
http://www.bkjia.com/PHPjc/326493.htmlwww.bkjia.comtruehttp: //www.bkjia.com/PHPjc/326493.htmlTechArticleset_include_path When setting the default include path in the include or require file, first find it in the default include path, and then in the same Find an example in the directory: D:/xampp/htdocs/test/include There is an article...