title: How to retrieve the session values in Yii 2
body: <p>I am facing the problem with Yii 2 session when I add the products to the cart session and fetch session cart values.</p>
  
  <pre><code>session_start();
  print_r($_SESSION);
  exit;
  </code></pre>
  
  <p>I got this line.</p>
  
  <pre><code>Array ( [__flash] =&gt; Array ( ) [__id] =&gt; 65 )
  </code></pre>
  
  <p>Also while trying Yii 2 way:</p>
  
  <pre><code>$session = Yii::$app-&gt;session;
  print_r($session);
  exit;
  </code></pre>
  
  <p>I am getting this value:</p>
  
  <pre><code>yii\web\Session Object ( 
      [flashParam] =&gt; __flash 
      [handler] =&gt; [_cookieParams:yii\web\Session:private] =&gt; Array ( [httponly] =&gt; 1 ) 
      [_hasSessionId:yii\web\Session:private] =&gt; 1   
      [_events:yii\base\Component:private] =&gt; Array ( ) 
      [_behaviors:yii\base\Component:private] =&gt;
  </code></pre>
  
  <p>How to get the session data with keys and values in Yii 2?</p>