TP5路由的位置致使錯誤

// 測試
'[js]'  => [
    ':id'   => ['test/test/js', ['method' => 'get'], ['id' => '\d+']],
    ':id/info'   => ['test/test/info', ['method' => 'get'], ['id' => '\d+']],
],
這一行的路由規則':id'   => ['test/test/js', ['method' => 'get'], ['id' => '\d+']]  會屏蔽下一行的規則,致使下一行的路由永遠不生效
好比: www.test.com/54 正常生效
www.test.com/54/info  沒生效,和www.test.com/54效果是同樣的


能夠換個位置便可
// 測試
'[js]'  => [
    ':id/info'   => ['test/test/info', ['method' => 'get'], ['id' => '\d+']],
    ':id'   => ['test/test/js', ['method' => 'get'], ['id' => '\d+']],
],

路由是一行一行匹配的測試

相關文章
相關標籤/搜索