首页模型层Model 基类
Model 基类
Kuoqi\Model(52 行):业务模型基类,行为配置绑定
本页内容
  1. 类定义要点
  2. 继承链中的定位

类定义要点

说明
构造子类存在 beforeBehavior() 时自动调用并 bindBehavior
bindBehaviorfinal 方法,opts 合并进 $__config
beforeBehavior返回行为配置数组(子类覆写)
典型用法
namespace App\Demo\Model;

class DemoModel extends \Kuoqi\Model\Model {
    protected $table_name = "demo";

    public function beforeBehavior(){
        // 行为配置(示例)
        return array("cache" => 60);
    }
}

继承链中的定位

介于 Core\Model(静态入口)与 Model\Model(数据库能力)之间:用户模型一律继承 \Kuoqi\Model\Model,自动获得 beforeBehavior 行为配置能力与全部数据库能力。

KuoqiPHP v1.05 · 离线静态文档 · 界面基于 KuoqiUI · 返回首页