$goods_info=Goods::find()->joinWith('brand','category')->orderBy('goods.goods_id desc')
$brand_model=new Brand()
$brand_info=$brand_model::find()->all()
$pages = new Pagination(['totalCount'=>$goods_info->count(),'pageSize'=>5])
$goods_info1=$goods_info->offset($pages->offset)->limit($pages->limit)->all()
return $this->render('list',['goods_info'=>$goods_info1,'brand_info'=>$brand_info,'brand_model'=>$brand_model,'pages' =>$pages])
2.视图页面list.php中
公共js在布局文件引入,也就是main.php单独view的js以及公共js都是使用$this->registerJs()
$this->registerJsFile()
$this->registerCss()
等方法引入
如果不行(上述方法一般可行,我在yii2就是这么用的),你可以使用use View(前面的命名空间忘记了,你找一下,里面有上所述的方法)
然后实例化$view = new View()然后$this->registerJs()等等