include_once and require_once have similar functions, that is, when including, check whether the included file has been included. If it has been included, it will not be executed, otherwise it will be included again. The reason why I say this first is because if include and require are Clear. Then there is no problem.
Now let’s talk about the difference between include and require:
The content included in the require() function is regarded as an integral part of the current file, so when the included file has syntax errors or the file does not When it exists, the PHP script of the current file will no longer be executed. The
include() function is equivalent to specifying the path of this file. When the included file is wrong, it will not affect the running of the own program. The
include function can be executed Determine whether it is included, while require is included regardless of the situation. So this is worth noting!
It is recommended that you use include when including dynamic files, that is, variables, functions, and classes. However, some time ago someone was analyzing the two The execution efficiency of a function. I have not tested this myself. I will add more after testing it myself
The above introduces require_once php include, include_once, require, require_once, including the content of require_once. I hope it will be helpful to friends who are interested in PHP tutorials.