DEV Community

Cover image for Passing Arguments in Routes (CakePHP)
Visakh Vijayan
Visakh Vijayan

Posted on • Updated on

Passing Arguments in Routes (CakePHP)

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

Top comments (0)