Passing Arguments in Routes (CakePHP)

Visakh Vijayan - Aug 11 '19 - - Dev Community

Question: How to pass arguments to a url in CakePHP

Solution:

In app/Config/routes.phg

Router::connect('/:arg', array('controller' => 'homes', 'action' => 'index', 'pass' => ['arg']));

Inside Homes/index()

index()
{
...
$passedOne = $this -> request -> params["arg"];
...

}

Hope it will be of use to someone. :D

. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .