/** * 删除版块 * @param $id */ public function delete($id) { try { $model = new BoardModel(); if ($model->delete($id) === false) { throw new Exception('删除失败'); } $this->redirect('index'); } catch (Exception $e) { $this->error($e->getMessage()); } }
public function index($id) { try { $model = new BoardModel(); $modelPost = new PostViewModel(); $board = $model->view($id, 1); list($postList, $page, $postCount) = $modelPost->getList(0, $id); $this->assign('board', $board); $this->assign('postList', $postList); $this->assign('page', $page); $this->assign('postCount', $postCount); $this->display(); } catch (Exception $e) { $this->error($e->getMessage()); } }