For getting complete URL:
By using the current_url() method we can get the current page URl of the page.
Example:
$page_url=current_url();
echo $page_url;
For getting URI segments:
By using the following statement we can get the segments in the URI.
Syntax:
$this->uri->segment(n);
where n=1 for controller
n=2 for method
n=3,4,5,6........ for parameters.
Example:
URL: http://localhost/nareshphp/login/home
echo $this->uri->segment(1); //It will returns login as output
echo $this->uri->segment(2); //It will returns home as output
For getting current controller and method names:
$this->router->fetch_class(); //It will returns controller name
$this->router->fetch_method(); //It will return current method name.
Keep Smiling....
By using the current_url() method we can get the current page URl of the page.
Example:
$page_url=current_url();
echo $page_url;
For getting URI segments:
By using the following statement we can get the segments in the URI.
Syntax:
$this->uri->segment(n);
where n=1 for controller
n=2 for method
n=3,4,5,6........ for parameters.
Example:
URL: http://localhost/nareshphp/login/home
echo $this->uri->segment(1); //It will returns login as output
echo $this->uri->segment(2); //It will returns home as output
For getting current controller and method names:
$this->router->fetch_class(); //It will returns controller name
$this->router->fetch_method(); //It will return current method name.
Keep Smiling....