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 ');