dongtuota3633 2017-06-23 02:03
浏览 130
已采纳

Yii从路径文件返回一个视图

How to make same thing in Yii? Code in Laravel:

web.php:

Route::get('blog', function () {
    return view('blog.index');
});

All I need is to return a view by url. Where and how can I do this? I didn't find good docs for this.

  • 写回答

1条回答 默认 最新

  • duanmie9682 2017-06-23 03:01
    关注

    You need to do this in your controller

    public function actionIndex(){
    
       return $this->render('view_name');
    }
    
    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论
编辑
预览

报告相同问题?