Tag Archive | ob_start

Warning: session_start(): Cannot send session cache limiter – headers already sent!!! Again – Codeigniter hacks


The same cache limiter problem this time in Codeigniter, if you have this kind of error you should change the redirect function with this one.

if ( ! function_exists('redirect'))
{
function redirect($uri = '', $method = 'location', $http_response_code = 302)
{
ob_start(); //new code
if ( ! preg_match('#^https?://#i', $uri))
{
$uri = site_url($uri);
}

switch($method)
{
case 'refresh' : header("Refresh:0;url=".$uri);
break;
default : header("Location: ".$uri, TRUE, $http_response_code);
break;
}
ob_end_clean(); //new code
exit;
}
}

Advertisements