问题
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);
来源:https://stackoverflow.com/questions/4524863/how-to-pass-argument-in-cakephp-requestaction