The include or require statement takes all the text/codde/markup that exists in the specified file and copies it into the file that uses the include statement.
The include and require statements are identical, except upon failture:
- require will produce a fatal error and stop the script
- include will only produces a warning and the script will continue
So if you want the execution to go on and show users the output, even if the include file is missing, use the include statement.Otherwise, in case of Framework or a complex PHP application coding, always use the require statement to include a key file to the flow of exectution.This will help you avoid compromising your application‘s security and integrity, just in-case one key file is accidentally missing.
include/require ‘filename‘
时间: 2024-10-02 05:27:31