加入收藏 | 设为首页 | 会员中心 | 我要投稿 李大同 (https://www.lidatong.com.cn/)- 科技、建站、经验、云计算、5G、大数据,站长网!
当前位置: 首页 > 站长学院 > PHP教程 > 正文

如何在Silex Framework中调试php致命错误

发布时间:2020-12-13 18:12:29 所属栏目:PHP教程 来源:网络整理
导读:我想知道如何看到这样的语法错误(缺少分号): ?phpvar_dump($app)? 这将导致WSOD(白屏死机). 我试图包含一个调试配置文件,如下所示: use SymfonyComponentDebugErrorHandler;use SymfonyComponentDebugDebug;// Include the prod configurationrequir
我想知道如何看到这样的语法错误(缺少分号):
<?php
var_dump($app)
?>

这将导致WSOD(白屏死机).

我试图包含一个调试配置文件,如下所示:

use SymfonyComponentDebugErrorHandler;
use SymfonyComponentDebugDebug;

// Include the prod configuration
require __DIR__.'/prod.php';

// Enable PHP Error level
error_reporting(E_ALL);
ini_set('display_errors','On');

// Enable debug mode
$app['debug'] = true;

// Handle fatal errors
ErrorHandler::register();

Debug::enable();

我包含在作曲家json文件中:

“symfony / debug”:“~2.3”,

但仍然没有变化.我忘记了什么?

试试这个:
use SymfonyComponentHttpKernelDebugErrorHandler;
use SymfonyComponentHttpKernelDebugExceptionHandler;

// set the error handling
ini_set('display_errors',1);
error_reporting(-1);
ErrorHandler::register();
if ('cli' !== php_sapi_name()) {
  ExceptionHandler::register();
}

// init application
$app = new SilexApplication();

// set debug mode
$app['debug'] = true

$app->run();

在初始化$app之前设置错误处理很重要.

(编辑:李大同)

【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容!

    推荐文章
      热点阅读