Yii 面试题与答案
问题 16. Explain Yii's RESTful API support.
Yii supports building RESTful APIs by providing RESTful actions and making it easy to expose models and data in a RESTful manner.
Example:
// class PostController extends CController { public function actions() { return array('rest' => 'ext.yii-rest-actions.ERestActionProvider'); }}
问题 17. What is Yii's asset bundles?
Asset bundles in Yii allow you to organize and manage assets such as CSS and JavaScript files, improving the efficiency of asset management.
Example:
// class MyAsset extends CAssetBundle { public $css = array('style.css'); } Yii::app()->clientScript->registerPackage('MyAsset');
问题 18. Explain Yii's URL management.
Yii provides a powerful URL management system that allows you to define clean and user-friendly URLs through rules and patterns.
问题 19. What is Yii's CActiveDataProvider?
CActiveDataProvider is a data provider in Yii that provides a set of data for widgets like grids and lists, making it easy to work with database data.
Example:
// $dataProvider = new CActiveDataProvider('Post', array('criteria' => $criteria));
问题 20. Explain Yii's behavior.
Behaviors in Yii allow you to enhance the functionality of a component by attaching additional methods and event handlers.
Example:
// class MyBehavior extends CBehavior { public function extraMethod() { // additional method } }
用户评价最有帮助的内容: