ice / framework

Source code of Ice framework
https://www.iceframework.org
BSD 3-Clause "New" or "Revised" License
341 stars 45 forks source link

route with extension #195

Closed Yahasana closed 5 years ago

Yahasana commented 6 years ago

How to setup a common route to match /module/controller/action/id/param.json

mruz commented 6 years ago

How about?


            ['*', '/{module:[a-z-]+}[/{controller:[a-z-]+}[/{action:[a-z-]+}[/{id}[/{param}]]]]'],
Yahasana commented 6 years ago

not works. this rule can't match .json

mruz commented 6 years ago

try [/{param:[a-z\.]+}]

Yahasana commented 5 years ago

['*', '/{module:[a-z-]+}[/{controller:[a-z-]+}[/{action:[a-z-]+}[/{id}[/{param}]]]]']

DON"T WORK: http://e.com/account/user/signup/id.json

WORK: http://e.com/account/user/signup/id/a.json

public function signupAction() {
    print_r(func_get_args());
}
Array
(
    [0] => id
    [1] => a
    [2] => json
)

WORK: http://e.com/account/user/signup/id/a/b.json

public function signupAction() {
    print_r(func_get_args());
}
Array
(
    [0] => id/a             <---------- what's wrong?
    [1] => b
    [2] => json
)
Yahasana commented 5 years ago

abandon fastroute & close