12345678910111213141516171819202122 |
- <?php
- namespace app\index\model;
- use think\Model;
- use think\Db;
- class LogApiModel extends Model
- {
- public function __construct()
- {
- $date = date('Ymd',time());
- $this->table = 'log_api'.'_'.$date;
- $exist = Db::query('show tables like "'.$this->table.'"');
- if(empty($exist)){
- $sql = "CREATE TABLE IF NOT EXISTS {$this->table} LIKE log_api";
- Db::execute($sql);
- }
- parent::__construct();
- }
- }
|