public function get9() { // get comments $request = Yii::$app->request; $page = $request->get('page', 1); $num = $request->get('num', 10); $id = $request->get('id'); $model = new \app\models\Comment(); $arr = $model->get($page, $num, $id); $back = ''; if (count($arr) > 0) { foreach ($arr as $key => $val) { $back .= CommentsWidget::widget(['model' => $val]); } } else { $back .= "\n <div>\n <p>哎呀,木有评论啦~\\(≧▽≦)/~啦啦啦</p>\n <img src='http://img.baidu.com/hi/jx2/j_0005.gif' />\n <p>Would you like leaving a comment?</p>\n <a href='javascript:;' onclick=\"\$(this).parents('.one-blog').find('.bottom-zujian').slideDown()\">OK,Comment now</a>\n </div>\n "; } $this->back['info'] = $back; $this->back['info2'] = $arr; }