开发者

What is the difference between include and required file in php?

开发者 https://www.devze.com 2023-02-03 08:14 出处:网络
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 i

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().

0

精彩评论

暂无评论...
验证码 换一张
取 消