模型
来自维基百科原文
模型管理着程序的主要行为和数据原文 响应关于状态的请求信息(通常来自于视图)[原文] (# > responds to requests for information about its state (usually from the view),) 也响应指令来改变状态(通常来源于控制器)[原文] (# > and responds to instructions to change state (usually from the controller).)
创建一个简单的模型原文
class Model_Post extends Model{public function do_stuff(){// This is where you do domain logic...}}
如果要使用数据库,只要使用模型继承Model_Database类即可原文
class Model_Post extends Model_Database{public function do_stuff(){// This is where you do domain logic...}public function get_stuff(){// Get stuff from the database:return $this->db->query(...);}}
