I've the referer url which is from $this->referer() is given below
http://localhost/project/users/login
And i want to get action of the referer url (previous url),
How can i get it ?
Thanks
To get the referer full base url, we use $this->referer()
, if you parse Router::parse($this->referer());
we get an empty array
but to restrict referring urls to local server, you've to use pass additional param like below
$refer_url = $this->referer('/', true); // you get like "/project/users/login"
Now if you parse the above returned value
$parse_url_params = Router::parse($refer_url);
you'll get the details of Controller, Action & Plugin
Here are the details:
Array (
[plugin] =>
[controller] => users
[action] => login
[named] => Array ()
[pass] => Array ( )
)
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With