【问题标题】:How to do a redirect to another page in CodeIgniter如何在 CodeIgniter 中重定向到另一个页面
【发布时间】:2017-03-17 11:25:08
【问题描述】:

您好,我想重定向出 CI 项目文件夹。

CI 目录:http://example.net/folder1/folder2/folder3/

我想重定向到的目录:http://example.net/folder1/folder2/

这是我用于重定向的函数。

public function load_website(){

    $this->load->helper('url');
    redirect('http://example.net/folder1/folder2/','refresh');
}//

此功能不起作用,并且停留在 CI 目录中。

我们将不胜感激。 谢谢

【问题讨论】:

    标签: php codeigniter redirect


    【解决方案1】:

    试试这个

    $this->output->set_header("Location:Enter Path");
    

    【讨论】:

    • 感谢帮助,有一个错字。无论如何,您的代码也可以正常工作,所以我将其标记为正确。
    【解决方案2】:

    重定向会刷新内容,因为它会激发新的呼叫 所以我认为你需要这样做:

    redirect ('folder1/folder2');
    

    【讨论】:

      猜你喜欢
      • 2015-12-12
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2011-08-22
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2019-11-04
      相关资源
      最近更新 更多