我正在研究一个宁静的 zend-API 框架工作。问题是,当发布请求时,我不知道如何将数据从控制器获取到单独的类中进行处理并将处理后的输出返回给控制器。即下面实现putAction函数的最佳方式
public function putAction()
{
$resource = $this->_getParam('resource');
$this->view->resource = $resource;
//$requests = $this->getRequest();
switch (true) {
case (strstr($resource, 'account')):
$response = $this -> do_post_request($requests);
$resource = "You are accessing account";
break;
case (strstr($resource, 'property')):
$response = $this -> do_post_request($requests);
$resource = "You are accessing property";
break;
case (strstr($resource, 'autos')):
$response = $this -> do_post_request($requests);
$resource = "You are accessing autos";
break;
default:
$resource = "The specified resource is not available please check the api manual for available resources";
break;
}
$this->view->message = $response;
$this->_response->ok();
}
在其他类中的其他函数处理后收集响应。如果我要使用: $response = $this -> do_post_request($requests); 其他类的结构将如何让它们处理请求并产生响应