0
在斯利姆3,这里是在应用程序中注入的自定义错误处理程序示例:苗条3激活的自定义错误处理程序
$container = new \Slim\Container();
$container['customError'] = function($c){
return function ($request, $response) use ($c) {
$output = ['success'=>0, 'error'=>"Custom Error Output."];
return $c['response']
->withStatus(400)
->withHeader('Content-Type', 'application/json')
->write(json_encode($output));
};
};
$app = new \Slim\App($container);
我的问题是,我怎么触发这个自定义错误?