Yii Framework official guide series 8-basic knowledge: Model

Source: Internet
Author: User
The model is a CModel or its subclass instance. The model is used to maintain data and related business logic. A model is a separate data object. It can be a row in a data table or a user-input form. Each word of the data object...



The model is a CModel or its subclass instance. The model is used to maintain data and related business logic.

A model is a separate data object. It can be a row in a data table or a user-input form. Each field of the data object corresponds to an attribute in the model. Each attribute has a label and can be verified by a series of rules.

Yii implements two types of models: Form model and Active Record model. Both of them inherit from the same base class CModel.

The form model is an instance of CFormModel. The form model is used to maintain the data obtained from user input. The data is often obtained, used, and discarded. For example, on a logon page, we can use a form model to indicate the user name and password provided by the end user. For more details, see use forms.

Active Record (AR) is a design pattern used to abstract database access through an object-oriented style. Each AR object is an instance of CActiveRecord or its subclass. Represents a row in the data table. The fields in the row correspond to the attributes in the AR object.

The above is the Yii Framework official guide series 8-basic knowledge: the content of the model. For more information, see The PHP Chinese network (www.php1.cn )!

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.