Set_include_path Setting the default include path
In the include or require file, first look in the default include path, and then in the same directory to find
Cases:
There is a file under D:/xampp/htdocs/test/include for cls.mysqli.php
There is a file under d:/xampp/htdocs/test/for set_include_path.php
Inside the content is
Copy CodeThe 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 Web site, but the drive letter where the file is located, using echo realpath ('/');
If the PHP version is too low, the function is not supported, the general version of Ini_set () can be used
/* View true default include path */
Echo Realpath (Get_include_path ());
/* To include cls.mysqli.php only required */
Require_once (' cls.mysqli.php ');
$mysql = new MySQL (' localhost ', ' root ', ' ', ' test '); Instantiation and subsequent query statements are not error-free
http://www.bkjia.com/PHPjc/326493.html www.bkjia.com true http://www.bkjia.com/PHPjc/326493.html techarticle Set_include_path Set the default include path in the include or require file, first find in the default include path, and then in the same directory to find an example: D:/xampp/htdocs/test/include under the article ...