Set_include_path and Get_include_path use and precautions _php skills

Source: Internet
Author: User
Set_include_path set default include path
In the include or require file, first look in the default include path, and then look in the same directory
Cases:
There's a file under D:/xampp/htdocs/test/include for cls.mysqli.php.
There's a file under d:/xampp/htdocs/test/for set_include_path.php.
The content inside is
Copy Code code as follows:

Set_include_path ('/xampp/htdocs/test/include '); Please note that the '/' inside of PHP is not the root of the site, but the letter of the file, available with echo realpath ('/');
If PHP version is too low, this function does not support, can be used General Edition Ini_set ()
/* View the true default include path * *
Echo Realpath (Get_include_path ());
* * To include cls.mysqli.php only need * *
Require_once (' cls.mysqli.php ');
$mysql = new MySQL (' localhost ', ' root ', ' ', ' test '); No errors in instantiated and subsequent query statements

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.