CodeIgniter Routing

后端 未结 3 1757
南笙
南笙 2020-12-14 13:33

I am developing an ecommerce website with CI that has product categories and products. I want to route the URL so that it will go to the products controller, then run the ge

3条回答
  •  予麋鹿
    予麋鹿 (楼主)
    2020-12-14 14:11

    CodeIgniter routes don't work well with regex. They are supported, not I can never get them to work. It would be much easier to catch them like this

    $route['products/(:any)'] = "products/getCategoryByName/$1";
    $route['products/(:any)/(:any)'] = "products/$1/getProductByName/$2";
    

提交回复
热议问题