0

我需要能够路由在查询字符串中传递信息的请求。例如,假设我的应用程序调用 /api/company/delete?id=17。如何在 DooPHP 中路由它?我已经定义了一个包罗万象的路由,它正在抓取这个请求,但我需要能够在没有包罗万象的路由的情况下处理这些。

# 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'); 

我错过了一些明显的东西吗?

4

1 回答 1

0

路线 $route['get']['/api/company/delete/:id'] = array('AdminController', 'deletecompany');

控制器 $this->params['id']

或者

路线 $route['post']['/api/company/delete'] = array('AdminController', 'deletecompany');

控制器 $_POST['id']

于 2013-09-12T08:32:12.900 回答