PHP

Use and precautions of set_include_path and get_include_path


set_include_path sets the default include path For include or require files, look in the default include path and then in the same directory Ex. : D: / xampp/htdocs/test/under include 1 file for cls. mysqli. php D: under/xampp htdocs test / 1 file for set_include_path. php The content inside is


set_include_path('/xampp/htdocs/test/include');  // Please note that php The inside of the '/' Does not represent the root of the site , It's the disk character where the file is located , available echo realpath('/'); To view
// if php Version too low, this function is not supported , Available general edition ini_set()
/* View the true default include path */
echo realpath(get_include_path());
/* To include cls.mysqli.php Only need to */
require_once('cls.mysqli.php');
$mysql = new Mysql('localhost','root','','test');  // There are no errors in the instantiation and subsequent query statements