如何包含php文件检查错误?

如何包含php文件检查错误?,php,Php,当Filter.php发出致命错误时,SuperFilter.php和footer.php将变为非活动状态,并且不会给出任何输出。那么,在包含inside search.php(主文件)之前,如何检查Filter.php是否有任何致命错误?您可以动态检查php中的解析错误 This is the main file: search.php // I want to include 6 files inside search.php. They are: 1.country.php 2.Sid

当Filter.php发出致命错误时,SuperFilter.php和footer.php将变为非活动状态,并且不会给出任何输出。那么,在包含inside search.php(主文件)之前,如何检查Filter.php是否有任何致命错误?

您可以动态检查php中的解析错误

This is the main file:
search.php


// I want to include 6 files inside search.php. They are:
1.country.php
2.Sidebar.php
3.Header.php
4.Filter.php  // this file sometimes gives "fatal error"
5.SuperFilter.php 
6.footer.php
但要检查致命错误,必须确保每个函数后面都有()。
这就是检查错误的全部。

您可以使用eval或file\u get\u contents进行测试。我成功地忽略了包含perse错误的脚本。但如何知道该脚本是否包含致命错误?为什么这是一个您必须动态解决的问题?在开发过程中修复错误,这样在网站最终发布时就不会出现问题。这是一个问题,因为我正在与团队中的其他开发人员一起制作不同的模块。这是必要的,因为在开发过程中,一个会妨碍另一个。我宁愿修复“致命错误”,而不是编写变通方法。代码需要稳定。如果您在一个团队中工作,那么使用版本控制系统(CVS、Subversion、Git、Mercurial等)可能适合您。
 $checkResult = eval("?>".$code_to_check) ;
 $status = "Correct code" ;
 //null and false both are 0 as value. but data-type are not same
 //if code is correct then $status = NULL and when wrong then it is false
 if($checkResult === false){
    $status = "Wrong code" ;
  }