Set_include_path and Get_include_path use and precautions _php tutorials

Source: Internet
Author: User
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 ...

  • 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.