Google News
logo
Yii framework - Interview Questions
What is Controller in the Yii framework?
Controllers are the glue that binds models, views, and other components together into a runnable application. Controllers are responsible for dealing directly with end-user requests. Therefore,
 
* Controllers may access $_GET, $_POST, and other PHP variables representing user requests.

* It may create model instances and manage their life cycles. Note that the actual implementation of saving a model should be located in the model instead of the controller.

* It should avoid containing embedded SQL statements, which are better kept in models.

* It should avoid containing any HTML or any other presentational markup, which is better kept in views.
Advertisement