how to pass argument in cakephp requestAction?

匿名 (未验证) 提交于 2019-12-03 08:57:35

问题:

anyone can tell me, how to pass arguments in cakephp $this->requestAction(...)?

回答1:

requestAction(string $url, array $options) 

This function calls a controller's action from any location and returns data from the action. The $url passed is a CakePHP-relative URL (/controllername/actionname/params). To pass extra data to the receiving controller action add to the $options array.

# echo $this->requestAction('/articles/view/5'); 


回答2:

Try this way:

$url = Router::url(array(     'controller' => 'Foo',     'action' => 'edit',     3 )); $this->requestAction($url); 


标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!