Yii has such a code, $post =post::model ()->findbyattributes ($attributes, $condition, $params);
Post::model ()->find ()->attributes.
How do you understand the model () here?
Reply to discussion (solution)
The model overrides the parent class method, instantiating the object of the class.
Your example, i.e. model () instance of post this class
Findbyattributes This method is also in the parent class.
This is the method in the Ar class. public static function model ($className =__class__) { if (isset (self::$_models[$className])) return self::$_ models[$className]; else { $model =self::$_models[$className]=new $className (null); $model->_md=new Cactiverecordmetadata ($model); $model->attachbehaviors ($model->behaviors ()); return $model;
Post::model () returns a specified object
The model method returns an instance of the post class.