开发者

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

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

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜