How to pass an argument to cakephp requestAction?

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

+3
source share
2 answers
requestAction(string $url, array $options)

This function calls the controller action from anywhere and returns data from the action. Missing $ url - relative CakePHP URL (/controllername/actionname/params). To transfer additional data to the action of the receiving controller, add $ options to the array.

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

Try as follows:

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

Source: https://habr.com/ru/post/1781956/


All Articles