app.php 1.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051
  1. <?php
  2. // +----------------------------------------------------------------------
  3. // | ThinkPHP [ WE CAN DO IT JUST THINK ]
  4. // +----------------------------------------------------------------------
  5. // | Copyright (c) 2006~2018 http://thinkphp.cn All rights reserved.
  6. // +----------------------------------------------------------------------
  7. // | Licensed ( http://www.apache.org/licenses/LICENSE-2.0 )
  8. // +----------------------------------------------------------------------
  9. // | Author: liu21st <liu21st@gmail.com>
  10. // +----------------------------------------------------------------------
  11. use think\facade\Route;
  12. use think\facade\Request;
  13. Route::domain('install.php', ':\app\install\controller');
  14. // 访问首页自动跳转到admin
  15. Route::rule('/', function () {
  16. if (Request::isMobile()) {
  17. return redirect('/wap');
  18. } else {
  19. return redirect('/web');
  20. }
  21. });
  22. // 管理后台
  23. Route::rule('admin', function () {
  24. return view(app()->getRootPath() . 'public/admin/index.html');
  25. })->pattern(['any' => '\w+']);
  26. // 站点端
  27. Route::rule('site', function () {
  28. return view(app()->getRootPath() . 'public/admin/index.html');
  29. })->pattern(['any' => '\w+']);
  30. // 站点管理端
  31. Route::rule('home', function () {
  32. return view(app()->getRootPath() . 'public/admin/index.html');
  33. })->pattern(['any' => '\w+']);
  34. // 装修端
  35. Route::rule('decorate/:any', function () {
  36. return view(app()->getRootPath() . 'public/admin/index.html');
  37. })->pattern(['any' => '\w+']);
  38. // 手机端
  39. Route::rule('wap', function () {
  40. return view(app()->getRootPath() . 'public/wap/index.html');
  41. })->pattern(['any' => '\w+']);
  42. // 电脑端
  43. Route::rule('web', function () {
  44. return view(app()->getRootPath() . 'public/web/index.html');
  45. })->pattern(['any' => '\w+']);
  46. //用于公众号授权证书
  47. Route::any('MP_verify_<name>.txt', function ($name) {
  48. header('Content-Type:text/plain; charset=utf-8');
  49. echo $name;exit();
  50. });