You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 
 

47 lines
1016 B

  1. <?php
  2. namespace app\index\controller;
  3. use app\common\controller\Frontend;
  4. use think\Lang;
  5. /**
  6. * Ajax异步请求接口
  7. * @internal
  8. */
  9. class Ajax extends Frontend
  10. {
  11. protected $noNeedLogin = ['lang'];
  12. protected $noNeedRight = ['*'];
  13. protected $layout = '';
  14. /**
  15. * 加载语言包
  16. */
  17. public function lang()
  18. {
  19. header('Content-Type: application/javascript');
  20. header("Cache-Control: public");
  21. header("Pragma: cache");
  22. $offset = 30 * 60 * 60 * 24; // 缓存一个月
  23. header("Expires: " . gmdate("D, d M Y H:i:s", time() + $offset) . " GMT");
  24. $controllername = input("controllername");
  25. $this->loadlang($controllername);
  26. //强制输出JSON Object
  27. $result = jsonp(Lang::get(), 200, [], ['json_encode_param' => JSON_FORCE_OBJECT | JSON_UNESCAPED_UNICODE]);
  28. return $result;
  29. }
  30. /**
  31. * 上传文件
  32. */
  33. public function upload()
  34. {
  35. return action('api/common/upload');
  36. }
  37. }