| 12345678910111213141516171819202122232425262728293031 |
- <?php
- namespace app\index\controller;
- use cmf\controller\HomeBaseController;
- use think\Db;
- class KnowController extends HomeBaseController
- {
- public function index()
- {
- $lists = Db::name('know')->whereIn('status',[1,2])->field('id,title,username,author,create_time')->paginate(20);
- $this->assign('lists',$lists);
- return $this->fetch();
- }
- public function show()
- {
- $param = $this->request->param();
- isset($param['id']) or $this->error('非法访问');
- $info = Db::name('know')->where('id',$param['id'])->find();
- $this->assign('info',$info);
- //seo
- $site_info = cmf_get_site_info();
- $seo_title = str_replace('|',$info['title'],$site_info['site_seo_title_knowlist']);
- $seo_keywords = str_replace('|',$info['title'],$site_info['site_seo_keywords_knowlist']);
- $seo_desc = str_replace('|',$info['title'],$site_info['site_seo_desc_knowlist']);
- $this->assign('seo_title',$seo_title);
- $this->assign('seo_keywords',$seo_keywords);
- $this->assign('seo_desc',$seo_desc);
- return $this->fetch();
- }
- }
- ?>
|