TP5 route location results in an error

// 测试
'[js]'  => [
    ':id'   => ['test/test/js', ['method' => 'get'], ['id' => '\d+']],
    ':id/info'   => ['test/test/info', ['method' => 'get'], ['id' => '\d+']],
],
Routing rule this line ': id' => [ ' test / test / js', [ 'method' => 'get'], [ 'id' => '\ d +']] will block the rules the next line, the next line of the route leading to never take effect 
, such as: www.test.com/54 works correctly
www.test.com/54/info not take effect, and the effect is the same www.test.com/54


You can change position to
// 测试
'[js]'  => [
    ':id/info'   => ['test/test/info', ['method' => 'get'], ['id' => '\d+']],
    ':id'   => ['test/test/js', ['method' => 'get'], ['id' => '\d+']],
],

Routing is matched line by line

 

Guess you like

Origin www.cnblogs.com/init-007/p/11760458.html