Home >Backend Development >PHP Tutorial >patcharapachaichua PHP include_path setting tips sharing
1. The meaning of include_path
When the functions include(), require(), and fopen_with_path() are used to search for files. When include_path is not set, when these functions open files, they will search in the web root directory by default. When After setting include_path, these php functions will first search under the specified include_path directory.
The principle is similar to the environment variables of the window system. When the window runs the cmd command, after entering some cmd commands, the system will set the Search the specified environment variables to see if these commands exist, and execute them if they exist.
2.include_path settings
The first method:
Modify the include_path item in the php.ini file.
include_path = .:/usr/local/lib/php:./include
Second method:
Use the ini_set method.
ini_set("include_path", ".:../:./include:../include");
3. Pay attention to
zendframework include setting index.php
Copy the code The code is as follows:
set_include_path('.' .PATH_SEPARATOR.'../library/'
.PATH_SEPARATOR.'./application/models/'
.PATH_SEPARATOR.'./application/lib/'
.PATH_SEPARATOR.get_include_path());
The above has introduced patcharapachaichua PHP include_path setting skills sharing, including patcharapachaichua content. I hope it will be helpful to friends who are interested in PHP tutorials.