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)

A Workflow Copilot. Tailored to You.

Pieces.app image

Our desktop app, with its intelligent copilot, streamlines coding by generating snippets, extracting code from screenshots, and accelerating problem-solving.

Read the docs