我需要能够路由在查询字符串中传递信息的请求。例如,假设我的应用程序调用/ api / company / delete?id = 17。如何在DooPHP中进行路由?我已经定义了一个catchall路由,它正在抓住这个请求,但是我需要能够在没有捕获路径的情况下处理它们。
# this doesn't work
$route['get']['/api/company/delete?id=:id'] = array('AdminController', 'deletecompany');
# at the bottom of my routes I have this catchall route, which works but it catches --everything--
$route['*']['catchall']['/:id'] = array('HomeController', 'getregions');
我错过了一些明显的东西吗?
答案 0 :(得分:0)
路由 $ route ['get'] ['/ api / company / delete /:id'] = array('AdminController','deletecompany');
控制器 $这 - > PARAMS [ 'ID']
或
路由 $ route ['post'] ['/ api / company / delete'] = array('AdminController','deletecompany');
控制器 $ _POST [ 'ID']