写操作日志的时候最好写一个基类,比如BaseCommonAction.class.php,使其他的页面可以继承他。class BaseCommonAction extends Action {
protected $_logCatArray = array(
'add' => '添加',
'save' => '修改',
'delete' => '删除',
);
protected $_logObjArray = array(
'member' => '会员',
'merchant' => '商户',
'diet_cate' => '菜系',
'business_area' => '商圈',
'area' => '区域',
'atmosphere' => '餐厅氛围',
'integral' => '积分',
'film' => '观影',
);
/**
+----------------------------------------------------------
* 管理员操作日志
+----------------------------------------------------------
*/
public function admin_log($log_cat,$log_obj,$log_con) {
$description = $this->_logCatArray[$log_cat] . $this->_logObjArray[$log_obj] .': '.'编号'. strip_tags($log_con);
$data = array (
'u_id' => $userid[Admin_uid],
'type' => $log_obj,
'log_time' => $this->regtime,
'ip' => $this->regip,
'log_info' => $description,
);
$insertId=$this->admin_log->add($data);//$this->admin_log是我的数据表操作
}
然后在你需要记录的页面调用admin_log($log_cat,$log_obj,$log_con)这个方法就行了