patcharapachaichua PHP include_path setting tips sharing

WBOY
Release: 2016-07-29 08:45:54
Original
1264 people have browsed it

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.
 PHP include_path设置技巧分享
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());


PATH_SEPARATOR is a constant, which is a ":" sign on Linux systems and a ";" sign on Windows.
So it is best to use the constant PATH_SEPARATOR instead when writing a program, otherwise errors will occur if the system is ported from Linux to Win or vice versa!
get_include_path gets the current existing environment variables, plus the previous settings, it is the new system include

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.

Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template