DEV Community

loading...
Cover image for Passing Arguments in Routes (CakePHP)

Passing Arguments in Routes (CakePHP)

Visakh Vijayan
Willing to learn anything and everything exciting. Always awake. Skips food for fun.
Updated on ・1 min read

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

Discussion (0)