getMessage(),getFile,getLine获取异常用法
try { $param = $request->all(); $param['building_id'] = 0; $param['sync'] = 2; // 1小程序2App $param['user_id'] = $receiveUser->id ?? 0; $follow = FollowTool::follow($param); if ($follow['status'] != 200) { empty($follow['msg']) ? $msg = "未知错误 follow" : $msg = $follow['msg'] . ' follow'; return response()->json(['status' => 404, 'msg' => $msg]); } } catch (\Exception $e) { $msg = [ 'file_path' => $e->getFile(), 'file_line' => $e->getLine(), 'message' => $e->getMessage() . ' follow', ]; return response()->json(['status' => 404, 'msg' => '捕获异常错误', 'data' => $msg]); }
赞赏码
![](https://files.cnblogs.com/files/lxwphp/zhifubao2.bmp)
![](https://files.cnblogs.com/files/lxwphp/weixin.bmp)
非学,无以致疑;非问,无以广识