首页›模型层›Model 基类
Model 基类
Kuoqi\Model(52 行):业务模型基类,行为配置绑定
本页内容
- 类定义要点
- 继承链中的定位
类定义要点
| 项 | 说明 |
|---|---|
| 构造 | 子类存在 beforeBehavior() 时自动调用并 bindBehavior |
bindBehavior | final 方法,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 ·
返回首页