Does it throw fatal error if included file contains fatal error in PHP?

半腔热情 提交于 2019-12-25 19:38:18

问题


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?

Does the same thing apply to require?

Please don't give me the links from PHP manual as I have already gone through it.

Thanks.


回答1:


Yes.

(PHP 4, PHP 5, PHP 7) The include statement includes and evaluates the specified file.

The documentation below also applies to require. (...)

From http://php.net/manual/en/function.include.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.



来源:https://stackoverflow.com/questions/41144882/does-it-throw-fatal-error-if-included-file-contains-fatal-error-in-php

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!