Home >Backend Development >PHP Problem >How to set the relevant configuration of the php path

How to set the relevant configuration of the php path

coldplay.xixi
coldplay.xixiOriginal
2020-10-30 15:35:523239browse

Methods to set the configuration related to the PHP path path: 1. [get_include_path()] to obtain the current environment variable; 2. [dirname (_FILE_)] The path of the current script file; 3. [dirname(dirname(_FILE_ ))】The directory of the previous level.

How to set the relevant configuration of the php path

Methods to set php path path related configuration:

1. get_include_path() to obtain the current environment variable, That is, the include_path set in php.ini;

set_include_path() is the path to set the include. After this setting, you can use include("conn.php") directly in other pages;

2. __FILE__: global variable, the full path of the file;

dirname (_FILE_): the path of the current script file;

dirname(dirname(_FILE_)): the upper-level directory.

PATH_SEPARATOR: path separator windows(;),Linux(:);

Related video recommendations: PHP programming from entry to proficiency

The above is the detailed content of How to set the relevant configuration of the php path. For more information, please follow other related articles on the PHP Chinese website!

Statement:
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

Related articles

See more