how to get id from url in cake php
11,042
$this->params['pass']
Returns an array (numerically indexed) of URL parameters after the Action.
// URL: /posts/view/12/print/narrow
Array
(
[0] => 12
[1] => print
[2] => narrow
)
Another Method is - Just pass the parameter to the function itself like as follows:
function add($id=null)
{
echo $id;
}
this will return your id
Author by
thecodedeveloper.com
With great power comes great responsibilities! Google and Stackoverflow are my best friends. My Blog - http://www.thecodedeveloper.com/
Updated on June 19, 2022Comments
-
thecodedeveloper.com almost 2 years
This is my action URL of which I'd like to get the 16.
http://localhost/carsdirectory/Galleries/add/16
Please help me.