TreeviewCopyright © aleen42 all right reserved, powered by aleen42

4.3 模型

模型是MVC模式重要组成部分,是代表业务数据、规则和逻辑的对象。

Model基类

框架内置模型基类\PG\MSF\Models\Model,任何模型都应该继承它,如:

示例代码:

https://github.com/pinguo/php-msf-demo/app/Models/Demo.php

通常情况控制器的属性或者方法在Model也可以使用,如:

  • $this->getConfig()

  • $this->getContext()

  • $this->getRedisPool()

  • $this->getRedisProxy()

  • this->getMysqlPool()

MSF框架中的Model并未深度的封装,它只有一个需求就是承继,从而使得在使用Model是简单、灵活。

links

results matching ""

    No results matching ""