php - Jump to next includedfile after encountering an error in included file
I have a main PHP file that includes lots of separate files, with no relation between them.
<?php
include_once 'test/test1.php';
include_once 'test/test2.php';
include_once 'test/test3.php';
include_once 'test/test4.php';
include_once 'test/test5.php';
include_once 'test/test6.php';
include_once 'test/test7.php';
?>
But when I run this PHP file, maybe I will encounter errors in each file. I want to know which code is appropriate if the main file is faced with any error. It shouldn't stop working, but jump to the next file.
How can I do that?
Answer
Solution:
include_once
will show a warning and continue execution to the next line, it will not exit out .require_once
will throw the error and exit out of the program.