| 123456789101112131415161718192021222324252627282930 |
- <?php
- /**
- * Created by PhpStorm.
- * User: 道行
- * Date: 2021-01-17
- * Time: 17:46
- */
- namespace app\model;
- use think\Model;
- class BaseModel extends Model
- {
- //返回模型实例
- public static function getInstance()
- {
- return new static();
- }
- //获取某一条数据
- public function getOne($where)
- {
- if (!is_array($where)) {
- $where = [$this->getPk() => $where];
- }
- return $this->where($where)->find();
- }
- }
|