The Set_include_path function ____ function of PHP

Source: Internet
Author: User

PHP's Set_include_path function, is used to set the application directory, development projects when the rational application of this function, allows us to include without a layer of the calculation directory, but also to improve the efficiency of our development, reduce the file contains error rate

See an example

Create a new 2 php file, a directory location structure as follows

/index.php

/include/config.php

index.php Code:

<?php Set_include_path ("include"); Include ("config.php");?>

/include/config.php Code:

<?php Set_include_path ("include"); Include ("config.php");?>

Now we run the index.php how to see the results, we include only write config.php can be included in the/inlcude/config.php file.

When setting multiple include directories, use the ";" Number separate.  such as: Set_include_path ("Include;include2;include3;lib;c:/php/lib"), you can use a relative path or a relative path. Perhaps this small code you may not feel the benefits of Set_include_path, but it does not matter, you just remember that such a code can achieve such a function, in your later technology, open the development of large projects do not forget to have such a function, he can reduce your workload.

The sister function Get_include_path () can get the include directory at that time, realize set_include_path the same function and our powerful and lovely Ini_set () Usage:

Ini_set (' include_path ', ' directory name ');

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.