public function actionDetails() { if (Yii::$app->request->isGet) { $modelsDetail = new MerBase(); //实例化商家信息 $modelsComment = new Comment(); //实例化评论 $modelsUser = new Students(); //实例化用户信息 $mer_id = Yii::$app->request->get('mer_id'); $mer_details = $modelsDetail->getDetail($mer_id); $comments = $modelsComment->getUserComment($mer_id); $pages = $comments['pages']; unset($comments['pages']); foreach ($comments as $key => $comment) { $user_id = $comment['user_id']; $comments[$key]['img'] = $modelsUser->getStuDetails($user_id); } $mer_id = $mer_details['mer_id']; $session = yii::$app->session; $session->set('mer_id', $mer_id); return $this->render('details', ['mer_details' => $mer_details, 'comments' => $comments, 'pages' => $pages]); } }