Welcome Guest, Not a member yet? Register   Sign In
Redirect error
#1

[eluser]Moon 111[/eluser]
Fatal error: Call to undefined function redirect() in C:\wamp\www\CodeIgniter\system\application\controllers\test.php on line 9

Code:
Class Test Extends Controller {

    public function index() {
        
        redirect(APPPATH . 'controllers/notloggedin.php');
    }
}

I was told by someone on this forum that such a function exists. Why isn't it working?
#2

[eluser]jtkendall[/eluser]
You have to load the URL helper before you can use redirect(). So just put the following line of code before your redirect call.

Code:
$this->load->helper('url');
#3

[eluser]Moon 111[/eluser]
Thanks!
#4

[eluser]Unknown[/eluser]
[quote author="jtkendall" date="1222615640"]You have to load the URL helper before you can use redirect(). So just put the following line of code before your redirect call.

Code:
$this->load->helper('url');
[/quote]

Where to write this?

Code:
function set_header($header, $replace = TRUE)
{
  $this->load->helper('url');
  // If zlib.output_compression is enabled it will compress the output,
  // but it will not modify the content-length header to compensate for
  // the reduction, causing the browser to hang waiting for more data.
  // We'll just skip content-length in those cases.
  
  if ($this->_zlib_oc && strncasecmp($header, 'content-length', 14) == 0)
  {
   return;
  }

  $this->headers[] = array($header, $replace);

  return $this;
  
}

Doesn't work...
#5

[eluser]InsiteFX[/eluser]
@Esnyper,

SEE: CodeIgniter Users Guide - Output Class




Theme © iAndrew 2016 - Forum software by © MyBB