指定文件加入log日志

<?php
$str = "要加入的内容";
$file = fopen("./log.log", "a+");        //创建文件或打开文件
fwrite($file, $str); //写入
fclose($file);          //关闭文件


或者使用下面显示更清晰

$data = [1,2,3];
//加入log
file_put_contents('./paypal.log', '[' . date('Y-m-d H:i:s') . ']' . var_export($data,true) . PHP_EOL,FILE_APPEND);

?>
posted @ 2020-02-26 15:29  祈愿仙帝  阅读(243)  评论(0编辑  收藏  举报