php中include()和require()区别

来源:互联网 发布:apache是什么网络模型 编辑:程序博客网 时间:2024/04/28 15:41

经常在编程中遇到include()和require()函数。对他们的区别却不是很了解。查询google.com(searching "include  requirement difference")得到下面一个结论,好像在哪看到过

“The difference is that if we use require_once() then the file to be added should exist in the given path,if not it will display a fatal error.if we use a include_once there will be no more problem due to this ,if there exist no such file.if we need to include a file then we will prefer include_once() because it will include the file once,it willnot include the file if it is inluded earlier”

就是说用require()函数的时候如果没有包含的文件的时候,回提示错误。而用inc lude()的时候应该是警告。这好像是他们的区别。区别对于编写程序的人来说不是很大。

我相信大家都知道require_once()和require()的区别吧。如果有什么问题,欢迎大家给我留言。


原创粉丝点击