Php 在包含的文件中遇到错误后跳转到下一个包含的文件

Php 在包含的文件中遇到错误后跳转到下一个包含的文件,php,php-include,Php,Php Include,我有一个主PHP文件,其中包含许多独立的文件,它们之间没有关系 <?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/test

我有一个主PHP文件,其中包含许多独立的文件,它们之间没有关系

<?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';
?>

但是当我运行这个PHP文件时,可能会在每个文件中遇到错误。我想知道如果主文件遇到任何错误,哪种代码是合适的。它不应该停止工作,而是跳转到下一个文件。

如何执行此操作?

include_once
将显示警告并继续执行到下一行,但不会退出


require\u once
将抛出错误并退出程序。

您遇到了什么错误?请您更具体一点好吗?你想做什么,为什么你期待错误?谢谢你的关注,我的朋友们,每个文件都从不同的网站获取数据。有时服务器没有响应,包含的文件遇到错误,它会阻止运行其他文件。不是所有人都在那里帮助我吗?此外(尽管这是一种不好的做法),您可以在函数的from中添加
@
,以抑制任何错误,例如
@include_once“file.php”