[PHP] include details. The order in which include files are loaded is: first, find the file in the relative include_path of the current working directory, and then the order in which inclu include files are loaded in the directory where the current
After two php include operations, the variables in the first include operation are invalid. directory structure + & nbsp; root & nbsp; index. php & nbsp; config. php & nbsp; after two php include operations, the variables in the first include
Include File Loading SequenceThe order of searching for contained files is:
First, search for the corresponding include_path in the current working directory,Find the corresponding directory named include_path.For example, include_path is ., the
Require and include are almost the same, except for different methods of handling failures. Require generates an E_COMPILE_ERROR-level error when an error occurs. In other words, it will cause the script to stop and include will only generate a
Under include_path, and then under include_path, where the current running script is located. For example, include_path is ., the current working directory is/www/, and the script should include an include/. php tutorial and include "B. php ", then
Joe Brockmeier briefly introduces the PHP scripting language, discusses the origin, performance, and application Platform of PHP. A simple example of a PHP script illustrates its basic syntax and usage.
If you are working on web-based development,
Require
Require and include are almost exactly the same, in addition to handling failures differently. Require generates an E_COMPILE_ERROR level error when an error occurs, in other words, causes the script to abort and the include only generates a
PHP Tutorial Require/include sequence
In a large Web project, Include_path is fundamental to a modular design (and of course, there are many autoload-based designs that do not affect this article), but precisely because of Include_path, It often
Include Load file order
The order in which to look for include files is:
First, in the current working directory of the relative include_path under the search,Then look under the include_path of the directory where the script is currently
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.