Home > Article > Backend Development > Several differences between require and include in php
If the php.ini configuration file is configured with URL fopen wrappers, then require can use the URL to include calls to remote files
require cannot contain control structures, and cannot contain return statements, which will cause a processing error.
require will be the first When executed this time, the contents of the included file will be replaced here, and include will be called again every time it is called. Therefore, require cannot include different files in the loop body.
require can access variables in the current scope
require occurs If an error occurs, the operation will stop immediately and an exception will be reported, and include will continue to execute after displaying the error message.
In the require in the conditional statement, regardless of whether the condition is established, the included content will be introduced, even if there is no chance of execution.