lumen 开启调试模式,关闭debug输出,只保留数据验证提示


我们在使用lumen验证数据输出时,往往会有debug详细错误输出,在正式模式中我们是不需要的,哪我们怎么关闭呢,很简单

修改文件:vendor\dingo\api\src\Exception\Handler.php

带debug模式的输出
 //  return new Response(array("code"=>1,"data"=>$response["message"],"debug"=>$response["debug"]), $this->getStatusCode($exception), $this->getHeaders($exception));
只有错误码和提示的输出
  return new Response(array("code"=>1,"data"=>$this->unicodeDecode($response["message"])), $this->getStatusCode($exception), $this->getHeaders($exception));
}
/*将unicodel转为中文*/
private function unicodeDecode($unicode_str){
$json = '{"str":"'.$unicode_str.'"}';
$arr = json_decode($json,true);
if(empty($arr)) return '';
return $arr['str'];
}
 

 


免责声明!

本站转载的文章为个人学习借鉴使用,本站对版权不负任何法律责任。如果侵犯了您的隐私权益,请联系本站邮箱yoyou2525@163.com删除。



 
粤ICP备18138465号  © 2018-2025 CODEPRJ.COM