如果包含的文件在PHP中包含致命错误,是否会引发致命错误? [英] Does it throw fatal error if included file contains fatal error in PHP?
问题描述
假设我正在使用include()函数将一个文件包含到我的程序中。
Suppose, I'm including a file into my program using include() function.
如果包含的文件存在,则还会正确指定包含文件的路径并且包含文件中的代码包含致命错误然后它会发出警告或致命错误吗?
If the included file is present, path of included file is also specified correctly and the code in included file contains fatal error then will it give a warning or fatal error?
同样的事情是否适用于require?
Does the same thing apply to require?
请不要给我PHP手册中的链接,因为我已经通过了。
谢谢。
推荐答案
是。
( PHP 4,PHP 5,PHP 7)
include语句包括并评估指定的文件。
以下文档也适用要求。 (...)
The documentation below also applies to require. (...)
来自 http://php.net/manual/en/function.include.php
使用include或import会将外部/单独文件中的内容代码添加到您自己的文件中,因此PHP解释器会将其检查为单个文件,如果它包含错误/通知,则会检测到它们。
Making use of include or import will add the content code from the external/separate file to your own file, so the PHP interpreter will check it as a single file and if it contains errors/notices they will be detected.
这篇关于如果包含的文件在PHP中包含致命错误,是否会引发致命错误?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!