Last updated on November 21, 2022
With the help of the CodeIgniter Built-in function redirect(), we can refresh or redirect the page based on the given parameters.
CI’s redirect() resides in the URL helper, so in order to use the redirect() function, you need to load the URL helper in the following way
$this->load->helper('url');
//or you can auto-load
redirect() function takes two parameters
The First Parameter is the destination
The second parameter allows the developer to use different HTTP commands to perform the redirect “location” or “refresh”.
According to the Code Igniter documentation, “Location is faster, but on Windows servers, it can sometimes be a problem.”
you can refresh the current page in CodeIgniter with the following line of code :
redirect($this->uri->uri_string());