In php file ofthe we use include and require a fi开发者_Python百科le. I think both are used for attaching an external file but when we use include and when require?
require()
will cause a fatal error if the file cannot be found, therefore terminating the script. include()
will only emit a warning, and the script will continue to run. So you should use require()
when you are including a library or something that you need for your script, and include()
when the include is optional.
In practice, I have only ever used require()
.
精彩评论