route.php 1.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142
  1. <?php
  2. // +----------------------------------------------------------------------
  3. // | ThinkPHP [ WE CAN DO IT JUST THINK ]
  4. // +----------------------------------------------------------------------
  5. // | Copyright (c) 2006~2016 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\Route;
  12. Route::group('apis', function () {
  13. Route::any('test', 'api/Demo/test');
  14. Route::get('index', 'api/Index/index');
  15. Route::get('article', 'api/Article/list');
  16. Route::get('article/:id', 'api/Article/detail');
  17. Route::get('story', 'api/Story/list');
  18. Route::get('story/:id', 'api/Story/detail');
  19. Route::get('about', 'api/About/list');
  20. Route::get('about/:id', 'api/About/detail');
  21. Route::get('product', 'api/Product/list');
  22. Route::get('product/:id', 'api/Product/detail');
  23. Route::get('cases', 'api/Cases/list');
  24. Route::get('cases/:id', 'api/Cases/detail');
  25. Route::get('cate/:type', 'api/Index/cates');
  26. });
  27. return [
  28. //别名配置,别名只能是映射到控制器且访问时必须加上请求的方法
  29. '__alias__' => [
  30. ],
  31. //变量规则
  32. '__pattern__' => [
  33. ],
  34. // 域名绑定到模块
  35. // '__domain__' => [
  36. // 'admin' => 'admin',
  37. // 'api' => 'api',
  38. // ],
  39. ];