//一、定义一个日志的方法
   public function clolog($str){
     $name=Session::get('uid');
     $this->assign("name",$name);
     $time = date('Y-m-d H:i:s');
     //组织成键值对
     $data = [
            'name'=>$name,
            'time'=>$time,
            'str'=>$str,
        ];
    $data = Db::table('log')->insert($data);    
   }

二、调用

 $this->clolog("添加商品分类成功!");

三、

<?php
namespace app\index\controller;
use think\Controller;
use think\Db;
use think\Session;
class Clolog extends Common{
    //日志
    function clolog(){
        $list = Db::name('log')->paginate(5,false,
            [
                'type'=>'BootstrapDetailed'
            ]
            );
        $this->assign('list', $list);
        return $this->fetch();
    }
}

相关文章:

  • 2022-12-23
  • 2021-12-03
  • 2021-09-14
  • 2022-12-23
  • 2021-12-03
  • 2021-10-06
  • 2021-05-29
  • 2021-12-29
猜你喜欢
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2021-07-08
  • 2022-12-23
  • 2021-09-30
相关资源
相似解决方案