Index.php 1.2 KB

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