[英]In lumen i want to add custom response for any exception
I added custom response into render method of handler.php like this: 我将自定义响应添加到handler.php的render方法中,如下所示:
public function render($request, Exception $e)
{
//$e->getTraceAsString();
$result['response']= 'false';
$result['exception']=$e->getMessage();
return response()->json($result);
/* return parent::render($request,$e);*/
}
if i update anything using composer ,will it be removed? 如果我使用composer更新任何内容,将其删除吗? there is any way to override handler class ?
有什么方法可以覆盖处理程序类?
composer update command will command to composer for generates a file called composer.lock which lists all your packages and the currently installed versions. composer update命令将命令composer生成一个名为composer.lock的文件,该文件列出了您的所有软件包和当前安装的版本。
However, you can run composer update --no-scripts
, this will run the composer update but will skip over the scripts added to the file. 但是,您可以运行
composer update --no-scripts
,这将运行composer更新,但将跳过添加到文件中的脚本。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.