PageController.php 1.7 KB

123456789101112131415161718192021222324252627282930
  1. <?php
  2. // +—————————————————————————————————————————————————————————————————————
  3. // | Created by Yunbao
  4. // +—————————————————————————————————————————————————————————————————————
  5. // | Copyright (c) 2013~2022 http://www.yunbaokj.com All rights reserved.
  6. // +—————————————————————————————————————————————————————————————————————
  7. // | Author: https://gitee.com/yunbaokeji
  8. // +—————————————————————————————————————————————————————————————————————
  9. // | Date: 2022-02-17
  10. // +—————————————————————————————————————————————————————————————————————
  11. namespace app\portal\controller;
  12. use cmf\controller\HomeBaseController;
  13. use app\portal\service\PostService;
  14. class PageController extends HomebaseController{
  15. public function index() {
  16. $postService = new PostService();
  17. $pageId = $this->request->param('id', 0, 'intval');
  18. $page = $postService->publishedPage($pageId);
  19. if (empty($page)) {
  20. abort(404, ' 页面不存在!');
  21. }
  22. $this->assign('page', $page);
  23. return $this->fetch();
  24. }
  25. }