If I'm on page https://www.example.com/test?page=123
how can I get this FULL PATH (proto + host + URI + query ) with Kohana?
I've tried Request::uri()
, Request::url()
: they don't give me full address string. Only URI part.
There is a URL helper which contains methods which will achieve your goal...
URL::base();
That should work for the host, if you tack it onto the front of your Request::uri()
. If you need the http://
on the front, add true
as the first parameter. Then there's...
URL::query();
which you can use to get the query string (and add additional parameters if necessary).
So something like...
$current_url = URL::base(true).Request::uri().URL::query();
should produce the full URL.