// +---------------------------------------------------------------------- namespace app\appapi\controller; use cmf\controller\HomeBaseController; use think\facade\Db; use think\db\Query; class PageController extends HomebaseController{ //文章 public function news() { $id = $this->request->param('id',0,'intval'); $news=Db::name("posts") ->field("post_title,post_content,post_title_en") ->where("id='{$id}'")->find(); $language=cmf_current_lang(); if($language=='en'){ $news['post_title']=$news['post_title_en']; } $this->assign("news",$news); $this->assign('id',$id); return $this->fetch(); } //读取常见问题下的文章列表 public function questions(){ $questionList=Db::name("posts") ->field("id,post_title,post_title_en") ->where("termid=13") ->select() ->toArray(); //$questionList->all(); $language=cmf_current_lang(); foreach($questionList as $k=>$v){ if($language=='en'){ $questionList[$k]['post_title']=$v['post_title_en']; } } $time=time(); $this->assign("questionList",$questionList); $this->assign("time",$time); return $this->fetch(); } }