コード例 #1
0
 public function actionIndex()
 {
     $page = $this->helpGquery('page', 1);
     $size = 9;
     $offset = ($page - 1) * $size;
     $comment = new Comment();
     $values = $comment->getComments(null, $offset, $size, null);
     $comments = $values['list'];
     array_walk($comments, function (&$value, $key) {
         $value['addtime'] = date('Y-m-d H:i', $value['addtime']);
     });
     $total = $values['total'];
     $pageHTML = $this->getPageHTML($page, $size, $total);
     $params = ['comments' => $comments, 'pageHTML' => $pageHTML];
     return $this->render('index', $params);
 }