如何转发zend 2动作

时间:2022-11-05 11:12:28

I am new to this forum. Please help me solve my issue.

我是这个论坛的新手。请帮我解决我的问题。

my controller is 'ClientController' and action to which I want to forward is 'EditClient'. I want to pass my current request to this action with the parameter 'id' = 23.

我的控制器是'ClientController',我要转发的动作是'EditClient'。我想通过参数'id'= 23将当前请求传递给此操作。

2 个解决方案

#1


0  

$forward = $this->forward()->dispatch('Client', array('action' => 'EditClient'));
return array(
    'id' => 21,
    'Client'=> $forward,
);

refer official document HERE

请参阅此处的官方文件

example at the github HERE

例如在github这里

#2


0  

In zend project your action URL is Client/EditClient/23
**Here is code sample.....**
<?php echo $this->url('Client', array('action'=>'EditClient', 'id' => 23));?>

#1


0  

$forward = $this->forward()->dispatch('Client', array('action' => 'EditClient'));
return array(
    'id' => 21,
    'Client'=> $forward,
);

refer official document HERE

请参阅此处的官方文件

example at the github HERE

例如在github这里

#2


0  

In zend project your action URL is Client/EditClient/23
**Here is code sample.....**
<?php echo $this->url('Client', array('action'=>'EditClient', 'id' => 23));?>