A model is an instance of CModel or its subclasses. Models are used to persist data and the business logic associated with it.
The model is a separate data object. It can be a row in a data table, or a form entered by a user. Each field of the data object corresponds to an attribute in the model. Each property has a label and can be validated through a series of rules.
YII implements two types of models: the form model and the Active Record. Both inherit from the same base class CModel.
The form model is an instance of Cformmodel. The form model is used to keep the data obtained from the user's input. These data are often acquired, used, and then discarded. For example, on a login page, we can use the form model to represent the user name and password information provided by the end user. For more information, please refer to using the form.
Active Record (AR) is a design pattern used to abstract database access through object-oriented styles. Each AR object is an instance of a Cactiverecord or its subclasses. Represents a row in a data table. The fields in the row correspond to the properties in the AR object.
The above is the Yii Framework Official Guide Series 8--basic knowledge: The content of the model, more relevant content please pay attention to topic.alibabacloud.com (www.php.cn)!