更新时间:2023-11-17 12:44:10
还有require
和include_once
.
所以你的问题应该是...
So your question should be...
require
与 include
?require_once
与 require
require
vs. include
?require_once
vs. require
此处描述了 1 的答案.
require() 函数与 include() 相同,只是它处理错误的方式不同.如果发生错误,include() 函数会生成警告,但脚本将继续执行.require() 产生致命错误,脚本将停止.
The require() function is identical to include(), except that it handles errors differently. If an error occurs, the include() function generates a warning, but the script will continue execution. The require() generates a fatal error, and the script will stop.
可以在此处找到 2 的答案.
The answer to 2 can be found here.
require_once() 语句与 require() 相同,除了 PHP 会检查文件是否已经被包含,如果是,则不再包含(要求)它.
The require_once() statement is identical to require() except PHP will check if the file has already been included, and if so, not include (require) it again.