2013-11-01 43 views
0

main.phpYii中的cookie登錄不工作

'user'=>array(
     // enable cookie-based authentication 
     'loginUrl'=>array('site/prijava'), 
     'allowAutoLogin'=>true, 
    ), 

LoginForm.php

if($this->_identity->errorCode===UserIdentity::ERROR_NONE) 
    { 
     $duration=$this->rememberMe ? 3600*24*30 : 0; // 30 days 
     Yii::app()->user->login($this->_identity,$duration); 
     return true; 
    } 

我沒有這個代碼defaut Yii應用改變。當我檢查「記住我」並登錄時,我必須在關閉瀏覽器時重新登錄。我檢查了$持續時間,它被設置爲3600 * 24 * 30。 Chrome和Mozzila也採用同樣的行爲,並啓用了Cookie。

回答

0

您也需要設置應用程序ID在你main.php

'id' => 'myapp', 
+0

同樣的事情...也許這是具有在登錄時許多變量(和數組),我把用的setState(的問題),而當我刪除它們中的一些它創建cookie然後工作。也許這是一個長期的cookie(4KB)的問題。我需要所有這些信息,我該怎麼辦? – gormit

+0

嘗試指定'session-> savePath'並確保它是可寫的。 – Oleg