Zend framework Zend路由和HTTP谓词/方法
您好,我正在尝试在Zend应用程序中设置一些REST路由,我想知道如何限制可以访问路由的HTTP方法Zend framework Zend路由和HTTP谓词/方法,zend-framework,http,rest,routes,zend-route,Zend Framework,Http,Rest,Routes,Zend Route,您好,我正在尝试在Zend应用程序中设置一些REST路由,我想知道如何限制可以访问路由的HTTP方法 $route = new Zend_Controller_Router_Route('user/reset_password', array( 'module' => 'default', 'controller' => 'user', 'action' => 'resetpassw
$route = new Zend_Controller_Router_Route('user/reset_password', array(
'module' => 'default',
'controller' => 'user',
'action' => 'resetpassword'
));
$front_controller->getRouter()->addRoute('reset_password', $route);
在这个路由中,我想指定这个路由将响应的HTTP谓词,比如GET、POST、PUT等,比如在数组中添加“method”=>“POST”
谢谢,在ZF的当前实现中,您不能这样做,因为它将路由接口声明为:
interface Zend_Controller_Router_Route_Interface {
public function match($path);
public function assemble($data = array(), $reset = false, $encode = false);
public static function getInstance(Zend_Config $config);
}
正如您所看到的,没有方法参数的空间
但是,您可以在控制器中执行所有检查,或者编写自己的路由器