How to get the previous url of a page in codeigniter

I need the confidential url of the page in a variable and find it inside the controller. is there any way to find it? Please help me. Using the following redirect code ($ this-> agent-> referrer ());

i can be redirected to the previous page. but I need this inside a variable to check.

+3


source to share


2 answers


try this:

$this->load->library('user_agent');
if ($this->agent->is_referral())
{
    $refer =  $this->agent->referrer();
}

      



This way you load the library user_agent

, check if the referral url is there and then store it in a variable to use it after

+5


source


This might be helpful



$url= $_SERVER['HTTP_REFERER'];

      

+2


source







All Articles