1 absolute, relative, and indeterminate paths
Relative path
A relative path refers to a path that begins with a.
./a/a.php (relative to current directory)
.. /common.inc.php (relative superior directory),
Absolute path
Absolute path is
Summarize:1. Include or require contains other files used./or. /, the current path and the previous layer path, depending on the path of the script being run, will have the following problem.When you write PHP programs, you often use include or
The include (), require () statement contains and runs the specified file. The two structures are exactly the same on the containing file, and the only difference is the handling of the error. The require () statement stops when it encounters a
First, let's take a look at the description of the include file search principles in the PHP official manual:
Files for including are first looked for in each include_path entry relative to the current working directory, and then in the directory of
The answer is: when the server uses the php feature (function) to include any file, the source of the file to be included is not strictly filtered, so that it can contain a malicious file, we can construct this malicious file to achieve the evil
Include () and require () statements include and run the specified file. The two structures are exactly the same on the contained files, and the only difference is the handling of errors. When the require () Statement encounters an error or the
Summary of require and include path issues in PHP, Requireinclude
1 absolute path, relative path, and indeterminate path
Relative path
A relative path refers to a path that begins with a.
./a/a.php (相对当前目录) ../common.inc.php (相对上级目录),
Absolute
Require and include path issues in PHP, Requireinclude
1 absolute path, relative path, and indeterminate path
Relative path
A relative path refers to a path that begins with a.
Copy the Code code as follows:./a/a.php (relative to current directory).
Include () and require () statements include and run the specified file. The two structures are exactly the same on the contained files, and the only difference is the handling of errors. When the require () Statement encounters an error or the
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.