Set in php

Source: Internet
Author: User
Welcome to the Linux community forum and interact with 2 million technical staff to enter the set_include_path function in php. Usage: The set_include_path function in php can be used to set the application directory and properly apply these functions during project development, this not only frees us from a layer-by-layer computing directory during include, but also improves our development efficiency and reduces

Welcome to the Linux community forum and interact with 2 million technical staff> enter the set_include_path function in php. Usage: The set_include_path function in php can be used to set the application directory and properly apply these functions during project development, this not only frees us from a layer-by-layer computing directory during include, but also improves our development efficiency and reduces

Welcome to the Linux community forum and interact with 2 million technicians>

Usage of the set_include_path function in php:

The set_include_path function in php can be used to set the application directory. When developing a project, you can apply these functions properly. This not only eliminates the need for a layer-by-layer computing directory during include, it can also improve the development efficiency and reduce the file inclusion error rate.

For example:

Resume two PHP files, one directory

The location structure is as follows:

/Index. php

/Include/config. php

Index. php:

Set_include_path ("include ");

Include ("config. php ");

?>

/Include/config. php

Reference content is as follows:

I'm config. php under include.

Now we run index. php

Why? No results?

We can include the/inlcude/config. php file only by writing config. php during include.

Separate multiple include directories ";"

For example, set_include_path ("include; include2; include3; lib; c: \ php \ lib ");

You can use relative paths or sleep paths.

Maybe you may not feel the benefits of set_include_path in this small code, but it doesn't matter. You just need to remember that this code can implement this function. In the future, the technology will be improved, don't forget to have such a function when you start to develop large projects. It can reduce your workload.

The sister function get_include_path () can obtain the include directory at that time,

Set_include_path has the same functions as our powerful and cute 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.