all()); //操作的内容 $path = $request->path(); //操作的路由 $method = $request->getRealMethod(); //操作的方法 $ip = $request->ip(); //操作的IP $authorization = $request->header('Authorization'); $return_data = $response->getContent(); if(strlen($return_data) > 128){ $return_data = substr($return_data,128) . '......'; } try{ }catch (Exception $e){ echo $e->getMessage(); } return $response; } public function writeLog($input,$path,$method,$ip,$return,$authorization){ $data = array( 'path'=>$path, 'method'=>$method, 'ip'=>$ip, 'input'=>json_encode($input, JSON_UNESCAPED_SLASHES + JSON_UNESCAPED_UNICODE), 'out' => json_encode($return,JSON_UNESCAPED_SLASHES + JSON_UNESCAPED_UNICODE), 'authorization' => $authorization ); OperationLog::create($data); } }