zoukankan      html  css  js  c++  java
  • 接口输入内容输出到日志文件中

    在接口开发调试中 为了查看别人请求时带来的参数

    就可以把这些数据输出到日志文件中 方便查看

    代码如下:

         $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);
  • 相关阅读:
    HDU 1716 排列2
    HDU 3405 World Islands
    HDU 5624 KK's Reconstruction
    HDU 2689 Tree
    UVA 12075 Counting Triangles
    UVA 11100 The Trip, 2007
    [USACO 2004DEC] Navigation Nightmare
    [USACO 2017DEC] Barn Painting
    [Usaco2017 Dec] A Pie for a Pie
    [USACO 2017DEC] Greedy Gift Takers
  • 原文地址:https://www.cnblogs.com/djwhome/p/9285858.html
Copyright © 2011-2022 走看看