route.php 4.2 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798
  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. //\think\Route::rule('bbs/show/:id','\\app\\bbs\\index\\Content@show');
  12. use think\Route;
  13. if (is_file(RUNTIME_PATH.'routemy.php')) { //后台URL美化插件自定义的路由规则
  14. include RUNTIME_PATH.'routemy.php';
  15. }
  16. if (is_file(APP_PATH.'routemy.php')) { //用户自定义的路由规则
  17. include APP_PATH.'routemy.php';
  18. }
  19. Route::group(['name'=>'cms','ext'=>'html'], [
  20. 'show-<id>' =>['cms/content/show',['method'=>'GET|POST'],['id' => '\d+']],
  21. 'list-<fid>'=>['cms/content/index',['method'=>'GET|POST'],['fid' => '\d+']],
  22. 'mid-<mid>'=>['cms/content/index',['method'=>'GET|POST'],['mid' => '\d+']],
  23. 'show' => 'cms/content/show',
  24. 'list' => 'cms/content/index',
  25. 'index$' => 'cms/index/index',
  26. ]);
  27. // Route::group(['name'=>'shop','ext'=>'html'], [
  28. // 'show-<id>' =>['shop/content/show',['method'=>'get'],['id' => '\d+']],
  29. // 'list-<fid>'=>['shop/content/index',['method'=>'get'],['fid' => '\d+']],
  30. // 'mid-<mid>'=>['shop/content/index',['method'=>'get'],['mid' => '\d+']],
  31. // 'show' => 'shop/content/show',
  32. // 'list' => 'shop/content/index',
  33. // 'index$' => 'shop/index/index',
  34. // ]);
  35. Route::group(['name'=>'bbs','ext'=>'html'], [
  36. 'show-<id>' =>['bbs/content/show',['method'=>'GET|POST'],['id' => '\d+']],
  37. 'list-<fid>'=>['bbs/content/index',['method'=>'GET|POST'],['fid' => '\d+']],
  38. 'mid-<mid>'=>['bbs/content/index',['method'=>'GET|POST'],['mid' => '\d+']],
  39. 'show' => 'bbs/content/show',
  40. 'list' => 'bbs/content/index',
  41. 'index$' => 'bbs/index/index',
  42. ]);
  43. Route::group(['name'=>'qun','ext'=>'html'], [
  44. 'show-<id>' =>['qun/content/show',['method'=>'GET|POST'],['id' => '\d+']],
  45. 'list-<fid>'=>['qun/content/index',['method'=>'GET|POST'],['fid' => '\d+']],
  46. 'mid-<mid>'=>['qun/content/index',['method'=>'GET|POST'],['mid' => '\d+']],
  47. 'show' => 'qun/content/show',
  48. 'list' => 'qun/content/index',
  49. 'index$' => 'qun/index/index',
  50. ]);
  51. // Route::group(['name'=>'hy','ext'=>'html'], [
  52. // 'show-<id>' =>['hy/content/show',['method'=>'get'],['id' => '\d+']],
  53. // 'list-<fid>'=>['hy/content/index',['method'=>'get'],['fid' => '\d+']],
  54. // 'mid-<mid>'=>['hy/content/index',['method'=>'get'],['mid' => '\d+']],
  55. // 'show' => 'hy/content/show',
  56. // 'list' => 'hy/content/index',
  57. // 'index$' => 'hy/index/index',
  58. // ]);
  59. // Route::group(['name'=>'fenlei','ext'=>'html'], [
  60. // 'show-<id>' =>['fenlei/content/show',['method'=>'get'],['id' => '\d+']],
  61. // 'list-<fid>'=>['fenlei/content/index',['method'=>'get'],['fid' => '\d+']],
  62. // 'mid-<mid>'=>['fenlei/content/index',['method'=>'get'],['mid' => '\d+']],
  63. // 'show' => 'fenlei/content/show',
  64. // 'list' => 'fenlei/content/index',
  65. // 'index$' => 'fenlei/index/index',
  66. // ]);
  67. Route::group(['name'=>'p','ext'=>'html'], [
  68. '<plugin_name>-<plugin_controller>-<plugin_action>' =>['index/plugin/execute',['method'=>'get|post'],['plugin_name' => '[a-z_0-9]+','plugin_controller' => '[a-z_0-9\.]+','plugin_action' => '[a-z_0-9]+',]],
  69. ]);
  70. Route::group(['name'=>'page','ext'=>'html'], [
  71. '<id>$' =>['index/alonepage/index',['method'=>'GET|POST'],['id' => '\d+']],
  72. ]);
  73. Route::group(['name'=>'home','ext'=>'html'], [
  74. '<uid>$' =>['member/user/index',['method'=>'GET|POST'],['uid' => '\d+']],
  75. ]);
  76. // return [
  77. // '__pattern__' => [
  78. // 'name' => '\w+',
  79. // ],
  80. // '[hello]' => [
  81. // ':id' => ['index/hello', ['method' => 'get'], ['id' => '\d+']],
  82. // ':name' => ['index/hello', ['method' => 'post']],
  83. // ],
  84. // ];