PageController.php 1.2 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344
  1. <?php
  2. // +----------------------------------------------------------------------
  3. // | ThinkCMF [ WE CAN DO IT MORE SIMPLE ]
  4. // +----------------------------------------------------------------------
  5. // | Copyright (c) 2013-2019 http://www.thinkcmf.com All rights reserved.
  6. // +----------------------------------------------------------------------
  7. // | Licensed ( http://www.apache.org/licenses/LICENSE-2.0 )
  8. // +----------------------------------------------------------------------
  9. // | Author: 老猫 <thinkcmf@126.com>
  10. // +----------------------------------------------------------------------
  11. namespace app\portal\controller;
  12. use think\Db;
  13. use think\db\Query;
  14. use cmf\controller\HomeBaseController;
  15. class PageController extends HomeBaseController{
  16. // 首页
  17. public function index(){
  18. $id=$this->request->param('id');
  19. if(!$id){
  20. $this->assign("reason",'参数错误');
  21. $this->display(':error');
  22. exit;
  23. }
  24. $info=Db::name("posts")->field("id,post_title,post_content")->where("id={$id} and post_type=1")->find();
  25. if(!$info){
  26. $this->assign("reason",'参数错误');
  27. $this->display(':error');
  28. exit;
  29. }
  30. $this->assign("info",$info);
  31. return $this->fetch();
  32. }
  33. }