Apache本地環境下出現迴圈重新導向

來源:互聯網
上載者:User

標籤:

最近發現一個很奇怪的問題,用了很久的apache+php訪問項目,昨天突然不行了,出現了這個

然後我一點點測試,我用的是TP架構,Indexaciton的index中調用架構裡的一個redirect函數

public function index() {        /*if(empty($_SESSION[‘admin‘][‘admin_id‘])) {           $this->redirect(‘Public/login‘,‘‘ , 0,‘頁面跳轉中~‘);        }*/        if(empty($_SESSION[‘admin‘][‘admin_id‘])) {            if(!checkCookieAdmin()){                $this->redirect(‘Public/login‘,‘‘ , 0,‘頁面跳轉中~‘);            }        }             $this->display(‘Public:index‘);    }

在tp action.class.php redirect函數中調用redirect

protected function redirect($url,$params=array(),$delay=0,$msg=‘‘) {        if(C(‘LOG_RECORD‘)) Log::save();        $url    =   U($url,$params);        redirect($url,$delay,$msg);    }

functions.php 裡面的redirect函數

// URL重新導向function redirect($url,$time=0,$msg=‘‘){    //多行URL地址支援    $url = str_replace(array("\n", "\r"), ‘‘, $url);    if(empty($msg))        $msg    =   "系統將在{$time}秒之後自動跳轉到{$url}!";    if (!headers_sent()) {        // redirect        if(0===$time) {            header("Location: ".$url);        }else {            header("refresh:{$time};url={$url}");            echo($msg);        }        exit();    }else {        $str    = "<meta http-equiv=‘Refresh‘ content=‘{$time};URL={$url}‘>";        if($time!=0)            $str   .=   $msg;        exit($str);    }}

這樣分析下來,定向都是指向Public中的login的,但是不知道為什麼就是不渲染html頁面,始終出現迴圈重新導向。

解決的辦法:換成了Ngnix伺服器,竟然好了!好了!!!!很是神奇啊。。。。

希望各位大神們道出其中的奧秘!

Apache本地環境下出現迴圈重新導向

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.