1, include ()
Include (/path/to/filename)
The Include () statement contains a file at the location where it is invoked. An effect that contains a file with the same content as the data that copies the file at the location of the statement.
Parentheses can be omitted when using include ().
The include () statement can be executed according to criteria. Using include () in a conditional statement is a strange phenomenon that must be enclosed in a statement block brace or surrounded by other statement-bounding characters.
2, Include_once ()
include_once (filename)
The include_once () function acts as an include, but it first verifies that the file is already included. If it is already included, the include_once is no longer executed. Otherwise, you must include the file. Except this is exactly the same as include.
3, require ()
Require (filename)
Require () is, to a large extent, the same as include, where a template file is included where the require call sits.
There are two important differences between require and include. First, regardless of the location of the require, the documentation will be included in the script that appears require. For example, even if require is placed in an if statement that evaluates to FALSE, the specified file is still included.
The second important difference is that the script will stop running when the require error occurs, and the script will continue to execute if the include is used.
4, require_once ()
require_once (filename)
As the site grows larger, there may be duplicates containing some files. This may not be a problem, but it may not be desirable to have a variable that contains files that are overwritten after they are again included in the original file. There may also be another problem, that is, the conflict of function names in the included file. Using require_once can solve these problems.
The Require_once function ensures that the file is included only once. After Require_once is encountered, subsequent attempts to include the same file are ignored.