2017-04-24 14 views
1

私は真偽セッションが期限切れにならないという問題があり、これは真偽の私のコードです:Zend Frameworkに2:設定されたセッションの真偽タイムアウト

$adapter = $this->getServiceLocator()->get('doctrine.authenticationadapter.orm_default'); 
$adapter->setOptions(array(
    'objectManager' => $this->getEntityManager(), 
    'identityClass' => 'Application\Entity\User', 
    'identityProperty' => 'email', 
    'credentialProperty' => 'password')); 

$adapter->setIdentityValue($mail); 
$adapter->setCredentialValue($password); 
$authService = new AuthenticationService(); 
$result = $authService->authenticate($adapter); 

if ($result->isValid()) 
{ 
    $identity = $result->getIdentity(); 
    $authService->getStorage()->write($identity); 
    echo "valide"; 
} 
else 
    echo "invalide"; 

感謝。

+0

すべてのコードを自分で作成しましたか?そうでない場合は、どの外部モジュールを使用していますか?あなたの設定( '/ config/autoload/*')ではどんなモジュール設定でもセッション設定がありますが、どのモジュール設定でも '' Module.php''で余分な設定はどうですか? –

+0

@ThomasDutrionセッション設定や認証については何もありませんconfig。 – user3911183

+0

これは、PHPの基本設定から来ている可能性があります。 –

答えて

0

は、私は私の問題を解決する方法である:

if ($result->isValid()) 
{ 
    $session = new Container('Zend_Auth'); 
    $session->setExpirationSeconds(1800); 
    $identity = $result->getIdentity(); 
    $authService->getStorage()->write($identity); 
    echo "valide"; 
} 
else 
    echo "invalide"; 

私はオブジェクトのセッションZend_Authを取得し、その後、私は、有効期限の値を編集しました。 お手伝い願います!

関連する問題