一个php日志类
2013-10-24 16:23
197 查看
<?php
//author:lixiuran
class Log {
public static function writeLog($string) {
$string = date('H:i:s') . ': ' . $string . "\r\n";
$dir = dirname(__FILE__) . '/' . date('Y');
if ( ! is_dir($dir)) {
@mkdir($dir);
}
$filename = $dir . '/' . date('Y-m-d') . '.log';
$handle = @fopen($filename, 'a');
@fwrite($handle, $string);
@fclose($handle);
}
}
//author:lixiuran
class Log {
public static function writeLog($string) {
$string = date('H:i:s') . ': ' . $string . "\r\n";
$dir = dirname(__FILE__) . '/' . date('Y');
if ( ! is_dir($dir)) {
@mkdir($dir);
}
$filename = $dir . '/' . date('Y-m-d') . '.log';
$handle = @fopen($filename, 'a');
@fwrite($handle, $string);
@fclose($handle);
}
}
相关文章推荐
- 分享一个PHP调试日志类
- 一个简单php日志类
- 一个个人觉得比较好用的PHP日志类,给大家分享一下
- 分享一个用了很久的php日志类
- 怎么用php写一个日志功能的函数
- CENTOS下PHP不能将其错误日志单独输出到一个文件的问题解决
- PHP的一个日志记录工具类
- PHP+YII学习日志 ----建立一个应用
- php zend Framework 模板显示图片 显示不失败,就一个红叉叉
- 一个牛逼的PHP无限极分类
- php foreach数组的一个奇怪现象
- php连mysql的一个简单类
- php微信开发备忘-使用测试号开发时的一个坑
- 海量日志数据__怎么在海量数据中找出重复次数最多的一个;提取出某日访问网站次数最多的那个IP;提取出某日访问网站次数最多的前n个IP
- PHP+ajax实现注册的一个完整的例子
- Composer PHP 的一个依赖管理工具
- 自己写的一个小小的php登陆模块 推荐
- 一个高效的异步日志
- [PHP][Function]实现将一个文件夹下的所有文件及文件夹复制到另一个文件夹里(保持原有结构)[已验证][原创]
- 5分钟写一个PHP入门(转载)