这个错误是什么?
Error 310 (net::ERR_TOO_MANY_REDIRECTS): There were too many redirects.我使用PHP CodeIgniter和SimpleLoginSecure库,这是我的代码:
if ($this->session->userdata('logged_in')) {
redirect('admin/index');
}如何解决此错误?
问候
发布于 2011-08-02 12:12:52
我猜您得到了一个无限重定向循环:您被重定向到admin/index,这个代码片段将再次运行,并无限地重定向到admin/index。您可能希望向该代码段添加一个检查,并且只在您不在admin/index页面时执行重定向操作。
发布于 2017-03-27 06:29:24
不应在类的__construct()中使用重定向()函数。
发布于 2012-03-09 21:54:49
我的解决方案:
$self = $_SERVER['PHP_SELF'];
$str2use = strrchr($self, '/');
$length = strlen($str2use) -1;
@$fname = substr($str2use, 1, $length);
if ($fname != "YOURPHPSCRIPT.php"){
echo "<script>window.location='YOURPHPSCRIPT.php';</script>";
exit;
} https://stackoverflow.com/questions/6911808
复制相似问题