Base.php 1.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445
  1. <?php
  2. /**
  3. * lemocms
  4. * ============================================================================
  5. * 版权所有 2018-2027 lemocms,并保留所有权利。
  6. * 网站地址: https://www.lemocms.com
  7. * ----------------------------------------------------------------------------
  8. * 采用最新Thinkphp6实现
  9. * ============================================================================
  10. * Author: yuege
  11. * Date: 2019/9/21
  12. */
  13. namespace app\common\controller;
  14. use app\BaseController;
  15. use think\facade\Request;
  16. use think\facade\Cookie;
  17. class Base extends BaseController
  18. {
  19. public function initialize()
  20. {
  21. parent::initialize(); // TODO: Change the autogenerated stub
  22. }
  23. public function enlang()
  24. {
  25. $lang = Request::get('lang');
  26. switch ($lang) {
  27. case 'zh-cn':
  28. Cookie::set('cookie_var', 'zh-cn');
  29. break;
  30. case 'en-us':
  31. Cookie::set('cookie_var', 'en-us');
  32. break;
  33. default:
  34. Cookie::set('cookie_var', 'zh-cn');
  35. break;
  36. }
  37. $this->success('切换成功');
  38. }
  39. }