0

main.php

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

ログインフォーム.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;
    }

このコードはデフォルトの yii アプリケーションから変更していません。「remember me」にチェックを入れてログインすると、ブラウザを閉じるときに再度ログインする必要があります。$duration を確認したところ、3600*24*30 に設定されています。同じ動作が Chrome と Mozzila にあり、Cookie が有効になっています。

4

1 に答える 1

0

アプリケーションIDも設定する必要がありますmain.php

'id' => 'myapp',
于 2013-11-01T23:27:28.550 に答える