zoukankan      html  css  js  c++  java
  • 第三方接口回调,日志及写表日志的写法

    
    
    mysql建表:
    
    
    
    SET FOREIGN_KEY_CHECKS=0;
    
    -- ----------------------------
    -- Table structure for fanwe_bank_response
    -- ----------------------------
    DROP TABLE IF EXISTS `fanwe_bank_response`;
    CREATE TABLE `fanwe_bank_response` (
      `id` int(11) NOT NULL AUTO_INCREMENT,
      `user_id` int(11) NOT NULL,
      `user_name` varchar(100) NOT NULL,
      `mobile` varchar(100) NOT NULL,
      `response` varchar(1000) NOT NULL,
      `create_time` int(11) NOT NULL,
      `create_date` varchar(30) NOT NULL,
      PRIMARY KEY (`id`)
    ) ENGINE=InnoDB AUTO_INCREMENT=20 DEFAULT CHARSET=utf8;
    
    
    



      //
    测试充值回调信息写入

    function bank_response($user_id,$data) { $sql="select * from ".DB_PREFIX."user where AES_DECRYPT(mobile_encrypt,'__FANWEP2P__') =".$user_id; $user=$GLOBALS['db']-> getRow($sql); $log=array(); $log['user_id']=$user['id']; $log['user_name']=$user['user_name']; $log['mobile']=$user_id; $data=json_encode($data); $log['response']=$data; $log['create_time']=TIME_UTC; $log['create_date']=date("Y-m-d H:i:s",TIME_UTC); $GLOBALS['db']->autoExecute(DB_PREFIX."bank_response",$log); } //调试用写日志文件 function logger($log_content) { $max_size = 10000000; $log_filename = APP_ROOT_PATH."public/".$log_content['mchnt_txn_ssn']."_log.xml"; $GLOBALS['curr_log_file']=$log_filename; if( file_exists($log_filename) && (abs(filesize($log_filename))>$max_size) ) { unlink($log_filename); } file_put_contents($log_filename, var_export($log_content,TRUE),FILE_APPEND); } //调试用写日志文件 function logger2($log_content) { $max_size = 10000000; $log_filename = APP_ROOT_PATH."public/".$log_content['mchnt_txn_ssn']."_log2.xml"; $GLOBALS['curr_log_file']=$log_filename; if( file_exists($log_filename) && (abs(filesize($log_filename))>$max_size) ) { unlink($log_filename); } file_put_contents($log_filename, var_export($log_content,TRUE),FILE_APPEND); }
  • 相关阅读:
    python新手中常见疑惑及解答
    jquery中常见问题及解决办法小结
    javascript常用字符串函数和本地存储
    sublim3常用插件安装
    PHP-Yii执行流程分析(源码)
    PHP-流的概念与详细用法
    PHP-数据库长连接mysql_pconnect的细节
    PHP-"php://(类型)"访问各个输入/输出流以及全局变量$HTTP_RAW_POST_DATA讲解
    MySQL-LAST_INSERT_ID();使用注意事项
    SQL SERVER-时间戳(timestamp)与时间格式(datetime)互相转换
  • 原文地址:https://www.cnblogs.com/hnbiao/p/6124619.html
Copyright © 2011-2022 走看看