Does it throw fatal error if included file contain

2019-10-18 07:26发布

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条回答
▲ chillily
2楼-- · 2019-10-18 07:34

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.

查看更多
登录 后发表回答