Index.php 1.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051
  1. <?php
  2. namespace app\index\controller;
  3. use app\common\controller\Frontend;
  4. use think\Db;
  5. class Index extends Frontend
  6. {
  7. protected $noNeedLogin = '*';
  8. protected $noNeedRight = '*';
  9. protected $layout = '';
  10. public function index()
  11. {
  12. return $this->view->fetch();
  13. }
  14. //基础文章网页
  15. public function basedata(){
  16. $key = input('key','');
  17. if(!$key){
  18. exit;
  19. }
  20. $content = Db::name('basedata')->where('key',$key)->find();
  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. }