在laravel中遇到compact(),对其中参数不理解

public function listComment(){
        $comments=Comment::orderBy('id','desc')->paginate(10);
         $this->layout->title='Comment Listings';
         $this->layout->main=View::make('dash')->nest('content','comments.list',compact('comments'));
    }

代码如上,其中compact 参数 为什么是'comments'而不是$comments?

阅读 13.4k
2 个回答

compact('comments')=$comments

推荐问题