标签:string 记录 destination param API 接口 path 日志 result
/**
*
* API接口明细记录
* @param $uid
* @param string $classify 模块
* @param string $type 变动类型
* @param string $url 接口地址
* @param string $content 发送内容
* @param string $result 返回值
* @return bool
*/
function apilog($classify, $type, $url, $content, $result)
{
$destination = RUNTIME_PATH . 'log' . DS . date("Ym") . DS . date('d') . 'api.log';
$path = dirname($destination);
!is_dir($path) && mkdir($path, 0755, true);
if (is_file($destination) && floor(2097152) <= filesize($destination)) {
rename($destination, dirname($destination) . DS . time() . '-' . basename($destination));
}
$now = '[ 创建时间 ] ' . date("Y-m-d H:i:s");
$localurl = '[ 运行链接 ] ' . getUrl();
$classify = '[ 模块 ] ' . $classify;
$type = '[ 类型 ] ' . $type;
$url = '[ 接口链接 ] ' . $url;
$message = "---------------------------------------------------------------\r\n{$now}\r\n{$localurl}\r\n{$classify}\r\n{$type}\r\n{$url}\r\n";
$f = fopen($destination, 'a');
$file = fwrite($f, print_r($message . '[ 接口内容 ] ', true));
$file = fwrite($f, print_r($content, true));
$file = fwrite($f, print_r("\r\n[ 接口返回结果 ] ", true));
$file = fwrite($f, print_r($result, true));
$file = fwrite($f, print_r("\r\n\r\n", true));
return true;
}
标签:string,记录,destination,param,API,接口,path,日志,result 来源: https://blog.csdn.net/qq_30202073/article/details/121615133
本站声明: 1. iCode9 技术分享网(下文简称本站)提供的所有内容,仅供技术学习、探讨和分享; 2. 关于本站的所有留言、评论、转载及引用,纯属内容发起人的个人观点,与本站观点和立场无关; 3. 关于本站的所有言论和文字,纯属内容发起人的个人观点,与本站观点和立场无关; 4. 本站文章均是网友提供,不完全保证技术分享内容的完整性、准确性、时效性、风险性和版权归属;如您发现该文章侵犯了您的权益,可联系我们第一时间进行删除; 5. 本站为非盈利性的个人网站,所有内容不会用来进行牟利,也不会利用任何形式的广告来间接获益,纯粹是为了广大技术爱好者提供技术内容和技术思想的分享性交流网站。