Php 如何访问传入的请求

Php 如何访问传入的请求,php,model-view-controller,zend-framework,Php,Model View Controller,Zend Framework,如何在控制器..中访问此参数值 $router->map('Company', 'Company', array( 'controller' => 'companies', 'action' => 'add', 'paramkey' => 'paramvalue', 'anotherparam' => 'anothervalue')); 请帮我试试 $this->getRequest()->getParam('paramkey');

如何在控制器..中访问此参数值

$router->map('Company', 'Company', array( 
 'controller' => 'companies', 
 'action' => 'add', 
 'paramkey' => 'paramvalue', 
 'anotherparam' => 'anothervalue')); 
请帮我试试

$this->getRequest()->getParam('paramkey');
获取一个参数:

$this->getRequest()->getParam('paramkey'[, 'default value']);
获取所有参数:

$this->getRequest()->getAllParams();


我使用的是Zend Framework,所以Zend_Action_Controller中描述的方法:

/**
 * Gets a parameter from the {@link $_request Request object}.  If the
 * parameter does not exist, NULL will be returned.
 *
 * If the parameter does not exist and $default is set, then
 * $default will be returned instead of NULL.
 *
 * @param string $paramName
 * @param mixed $default
 * @return mixed
 */
protected function _getParam($paramName, $default = null)
如果您正在使用Caceph,您可以尝试

$this->params['paramkey'];

但我不确定它是否能工作

我刚刚测试过,一切正常,也许你在控制器中使用了错误或错误?你安装了zend吗??我的意思是,我想它应该在zend中定义。但是我必须在其中进行定制的s/w有自己的框架,但它类似于cakephp…那么让我知道在哪里可以找到getParam???我使用Zend框架,所以Zend_Action_Contoller中描述的方法:/***从{@link$\u request-request-object}获取一个参数。如果*参数不存在,将返回NULL。**如果参数不存在并且设置了$default,那么将返回*$default而不是NULL.**@param string$paramName*@param mixed$default*@return mixed*/protected function_getParam($paramName,$default=null)如果您使用的是phpCake,您可以尝试通过我的框架不是cakephp…我尝试了$this->param[]并且没有显示错误。但是没有比较值。$flag=$this->params['is_owner';如果(flag='1'),你能帮我定义方法吗?
$this->params['paramkey'];