2012-05-19 27 views
0

是否有可能在控制器中使用

$this->_forward("/url/here"); 
+0

的可能重複[PHP的,如何在Zend框架內手動發送帖子?](http://stackoverflow.com/questions/10611954/php-how-to-send-a-manual-post-within-在-的Zend框架) –

回答

2
public function fooAction() 
{ 
    // forward to another action in the current controller and module: 
    $this->_forward('bar', null, null, array('baz' => 'bogus')); 
} 

public function barAction() 
{ 
    // forward to an action in another controller: 
    // FooController::bazAction(), 
    // in the current module: 
    $this->_forward('baz', 'foo', null, array('baz' => 'bogus')); 
} 

public function bazAction() 
{ 
    // forward to an action in another controller in another module, 
    // Foo_BarController::bazAction(): 
    $this->_forward('baz', 'bar', 'foo', array('baz' => 'bogus')); 
} 

根據手冊,你可以發送參數與發送POST/GET參數一個數組,應該是最後一個參數。

+0

是張貼或得到什麼? – rjmcb

+1

GET。您無法發送POST請求。 (除非你提交表單或使用Zend_Http_Client) –