本文实例讲述了THINKPHP项目开发中的日志记录用法。分享给大家供大家参考。具体方法如下:1、建立日志表 复制代码 代码如下:CREATE TABLE `logs` ( `id` int(11) NOT NULL auto_increment, `guid` varchar(100) character set utf8 NOT NULL, `addtime` timestamp NOT NULL default CURRENT_TIMESTAMP, `account` varchar(100) character set utf8 NOT NULL, `nickname` varchar(100) character set utf8 NOT NULL, `app` varchar(100) character set utf8 NOT NULL, `action` varchar(100) character set utf8 NOT NULL, `method` varchar(100) character set utf8 NOT NULL, `query_string` text character set utf8 NOT NULL, `is_desc` varchar(100) character set utf8 NOT NULL, `desc` varchar(100) character set utf8 NOT NULL, `ipaddr` varchar(100) character set utf8 NOT NULL, `unique_flag` varchar(100) character set utf8 NOT NULL, PRIMARY KEY (`id`) ) ENGINE=InnoDB DEFAULT CHARSET=utf8 ; 2、Common/common.php里面进行方法的定义: 复制代码 代码如下:function getGlobalSkypeLogDbConfig() { $global_skype_db_config = array( 'dbms' = C('DB_TYPE'), 'username' = C('DB_USER'), 'password' = C('DB_PWD'), 'hostname' = C('DB_HOST'), 'database' = C('DB_NAME'), ); return $global_skype_db_config; }