php中include()和require()區別

經常在編程中遇到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()的區別吧。如果有什麼問題,歡迎大家給我留言。


發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章