最近發現一個很奇怪的問題,用了很久的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服務器,竟然好了!好了!!!!很是神奇啊。。。。
希望各位大神們道出其中的奧秘!
