在接口开发调试中 为了查看别人请求时带来的参数
就可以把这些数据输出到日志文件中 方便查看
代码如下:
$data= $request->getContent(); // 不是$data=$requeset->input(); // $data = '{"uuid":"1531134513345726366-120287-1-2-2093","type":"2","phone":null,"calldate":1531134523,"recordfile":"http://221.123.137.5:81/recordings/2018-07-09/17610072368.8889.19-08-56.395e873e-7310-41a8-9ba5-4bf20dca51cf.wav","data_id":"3461900000360837","app_id":"1","time_stamp":1531134546,"signInfo":"YOE7Wn9v77RL4i0oanqeYID07ZzUm0nD%2BaJ4t7ym0oGfd6zCcq5D5SxYMy8hThiItCvtq07hsefvce3Lg56XLuTJZaVUtUsmr5jtpncYzZGHp9sbr6vdRu9Uzi%2BVBVyHCXGoQtTRcMYqudfGukqRpkTkJvsDrJzdQ5Vt0r%2FHbgw%3D","intention":"C","intention_msg":"u901au8bddu6210u529f","duration":7}'; $data = json_decode($data); $file = Config::get('constants.MY_LOG'); // 这里是配置文件 // $content = file_put_contents($file, $data, FILE_APPEND); $content=file_get_contents("php://input"); file_put_contents($file, $content, FILE_APPEND | LOCK_EX); file_put_contents($file," ", FILE_APPEND | LOCK_EX);