Yii Interview Questions and Answers
Ques 1. What is Yii?
Yii is a high-performance PHP framework for developing web applications.
Example:
// Yii::app()->run();
Ques 2. Explain MVC architecture in Yii.
Yii follows the Model-View-Controller architectural pattern where the model represents the data, the view displays the data, and the controller handles user input and updates the model and view.
Example:
// class PostController extends CController { }
Ques 3. What is Yii's ActiveRecord?
Yii's ActiveRecord is an implementation of the Active Record pattern, providing an object-oriented interface for interacting with database tables.
Example:
// $post = new Post; $post->title = 'New Post'; $post->save();
Ques 4. Explain Yii's Gii tool.
Gii is a web-based code generation tool provided by Yii that helps in quickly generating code for models, controllers, forms, and more.
Example:
http://your-app/index.php?r=gii
Ques 5. What is Yii's widget?
Widgets in Yii are reusable components that can be embedded in views or layouts to encapsulate complex UI functionality.
Example:
// Yii::app()->widget('application.widgets.MyWidget', array('param'=>'value'));
Most helpful rated by users: