简体   繁体   中英

User “?” in fuelphp router

I config a router

'users/user(/fields=:fname,:lname,:age)?'   => 'users/user/$1/$2/$3',

used: /users/user/fields=John,Smith,33 (fname = John, lname = Smith, age = 33)

I want config like
users/user?fields=John,Smith,33

but I can't use "?" in a router.

Routing does not include GET parameters as they are not considered part of the URI. For the functionality that you desire you would be better off specifying a closure as the right hand side of the route and returning the constructed string.

'users/user' => function(){ 
    return 'users/user/' //Custom logic goes here to build the internal URI
}

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM