Tag Archives: codeigniter get current url in controller

Codeigniter get current url


Codeigniter get current url : Url helper is used to get the current url in Codeigniter. It contains the function that returns the current url. The function current_url() is used to get the current url in codeigniter. Using this function you can get current url anywhere on view, model, controller, Library or helper as well.


You Can Get The current url in codeigniter using the following function-

Codeigniter get current url On View | Controller | Model | Syntax Example

Codeigniter get current url

Here is syntax for current url-

current_url();

This function return current url. If want to get get current url anywhere on Controller, View or Model use the above function.

Make Sure the Url Helper is loaded before calling the function –

$this->load->helper('url');

Url Helper contains the functions which assist in url working. You can load this helper in _autoload.php because this function is frequently used in codeigniter.

I hope this article was helpful for you.