DEV Community

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

Posted on • Edited on

1

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)

Postmark Image

Speedy emails, satisfied customers

Are delayed transactional emails costing you user satisfaction? Postmark delivers your emails almost instantly, keeping your customers happy and connected.

Sign up