createUrl Yii - should we call it on controller view, or doesn't matter?
问题 Should createUrl be called on controller or in views ? It doesn't matter? Or it does matter ? Is there a rule we should follow ? Like methods that extend ccontroller should be used on controllers and so on .. ? 回答1: In View you can use this snippet. You can use this snippet everywhere. Yii::app()->createUrl(); But for me is better to define a url in controller's action, and use simply $some_url var in the view. class SomeController extends Controller { public function actionSomeAction() {