2013-10-21 2 views

답변

1

젠드 프레임 워크 2에서 세션은 키가 namespace이고 다른 값이 연관 배열 인 것처럼 보이는 연관 배열 인 것 같습니다.

세션을 조작하기 위해, 당신은 당신이 특정 공간에서 원하는 것을 쓸 Container

use Zend\Session\Container; 

// namespace 'user' 
$userContainer = new Container('user'); 

// Store the locale and devise 
$userContainer->locale = 'fr-FR'; 
$userContainer->devise = 'Euro'; 

라는 추상화 계층을 사용할 수 있습니다. 당신은 나중에 당신에게 데이터를 검색 할 수 있습니다 :

use Zend\Session\Container; 

// Create a container to manipulate session data 
$userContainer = new Container('user'); 

// Check if the data exist under the namespace 
if ($userContainer->offsetExists('devise')) 
{ 
    // Retrieve the data 
    $devise = $userContainer->offsetGet('devise'); 
} 
else 
{ 
    // Get the default value 
    $devise = 'Euro'; 
} 

PS : 물론, 세션을 사용할 수

+0

로케일이 있는지 확인하고 예를하는 고안, 당신은 당신이 – MatRt

+0

성공을 원하는 저장할 수 있습니다. 감사 – Patrioticcow