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);
  • 相关阅读:
    操作系统学习五部曲
    由实模式进入保护模式
    extends && implements
    <mvc:annotation-driven>
    集合类关系
    Servlet8
    SprigMVC基础测试
    (转载)synchronized代码块
    jetty与tomcat
    输入输出流总结
  • 原文地址:https://www.cnblogs.com/djwhome/p/9285858.html
Copyright © 2011-2022 走看看