codeigniter中的代理商推荐人未设置上一个网址

时间:2021-12-01 20:17:38

I am new in codigniter here got problem with getting previous url. I have following functions in codeigniter controller.

我是新的codigniter这里有问题得到以前的网址。我在codeigniter控制器中有以下功能。

public function contact_us() {
    $this->session->set_userdata('redirect_back', $this->agent->referrer());
    $this->load->view('contact_us');
}

public function find_us() {
    $this->session->set_userdata('redirect_back', $this->agent->referrer());
    $this->load->view('find_us');
}

I am getting referrer url in another Login controller like this,

我在另一个这样的Login控制器中获取referrer url,

public function index(){
    $redirect_url = $this->session->userdata('redirect_back');
    echo $redirect_url;
}

I am getting the url but the problem is when

我得到的网址,但问题是什么时候

  • I go to the contact_us function then go to Login controller I got nothing in $redirect_url variable
  • 我转到contact_us函数然后转到Login controller我在$ redirect_url变量中什么都没有

  • if I go to find_us function then go to Login controller then I get the URL of contact_us instead of find_us page
  • 如果我去find_us函数然后转到Login controller然后我得到contact_us的URL而不是find_us页面

I seriously confused or don't understand actuall functionality of user_agent referrer. Kindly provide me the solution or help how get rid of this and sorry if you dont understand my wording. Thanks

我严重混淆或不理解user_agent referrer的实际功能。请向我提供解决方案或帮助如何摆脱这一点,并抱歉,如果你不理解我的措辞。谢谢

1 个解决方案

#1


Codeigniter docs user agent

Codeigniter docs用户代理

The referrer, if the user agent was referred from another site.

如果用户代理是从其他站点引用的,则为引用者。

So only works when referred from another site, so it won't work inside your codeigniter application

因此只有在从其他站点引用时才有效,因此它不会在您的codeigniter应用程序中工作

#1


Codeigniter docs user agent

Codeigniter docs用户代理

The referrer, if the user agent was referred from another site.

如果用户代理是从其他站点引用的,则为引用者。

So only works when referred from another site, so it won't work inside your codeigniter application

因此只有在从其他站点引用时才有效,因此它不会在您的codeigniter应用程序中工作