Sinsing and you thoroughly analyze the differences between include and require in PHP
First of all, let's say require, we know that if the file it introduces does not exist, it will cause the program to fail to continue, so it is usually at the very front of the program, often a particularly important part, such as connecting to a database library, such as loading a configuration file, such as referencing a core library, and so on.
Then say the include, it is not important to introduce success, so it is very close to the characteristics of HTML, can be used in the beginning of the program, of course, many times we need to refer to the time to include in, so that its location is more arbitrary, can be placed in the middle.
There is also a include_once, which is much more expensive than include, why, because it will detect whether the file has been included, if it has been introduced, then will not be reintroduced, if there is no include in, then will include in, Its usage is the same as include, except that it does not import two times. There is also a require_once, it is also used to only require once the situation, the use and require are the same.
Why can't some files be imported multiple times? The reason is simple, for example, some files have a class definition, if we import multiple times, it is bound to cause a duplicate definition of the class, which will trigger the error, it should be avoided.