简体   繁体   中英

Fuelphp - pass default parameter to a controller in a rewrote route

I want to do something I thought was pretty basic using fuelphp Basically I need to use multiple urls with only one controller, and assign each different route a default parameter (a cat id for that matter)

For instance in my Listing controller I want to use 2 different routes :

/bags
/accessories

to each of which would be assigned it's cat id

Can't seem to find any easy way to do it in fuelphp...

You can specify a route like 'path/here/(:segment) => 'controller/cat/$1 which will then pass the segment captured in the route as the first parameter to a method called action_cat in the controller class.

This behaviour is pretty well outlined in the documentation http://fuelphp.com/docs/general/routing.html

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