Index.php 1.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657
  1. <?php
  2. namespace app\index\controller;
  3. use think\Controller;
  4. use think\Db;
  5. class Index extends Controller
  6. {
  7. public function index(){
  8. }
  9. //基础文章网页
  10. public function basedata(){
  11. $key = input('key','');
  12. if(!$key){
  13. exit;
  14. }
  15. $request = Request::instance();
  16. $this->lang = $request->header('lang','CN');
  17. $content = Db::name('basedata')->where('key',$key)->find();
  18. if($lang == 'EN'){
  19. $content['content'] = $content['content_en'];
  20. }
  21. $this->assign('content',$content['content']);
  22. return $this->fetch();
  23. }
  24. /**
  25. * app下载页
  26. * 判断是安卓还是ios
  27. */
  28. public function appdownload() {
  29. if(strpos($_SERVER['HTTP_USER_AGENT'], 'iPhone')||strpos($_SERVER['HTTP_USER_AGENT'], 'iPad')){
  30. header("Location: ".config('site.ios_downurl'));
  31. }else if(strpos($_SERVER['HTTP_USER_AGENT'], 'Android')){
  32. $this->view->assign('downurl', config("site.android_apkUrl"));
  33. return $this->view->fetch();
  34. }else{
  35. $this->view->assign('downurl', config("site.android_apkUrl"));
  36. return $this->view->fetch();
  37. }
  38. }
  39. }