title: php session flash message
body: <p>i'm tryning to create session flash message after redirection.</p>
  
  <p>i have Controller class</p>
  
  <pre><code>class Controller
  {
      function __construct()
      {
      if(!empty($_SESSION['FLASH']))
          foreach($_SESSION['FLASH'] as $key =&gt; $val)
          $this-&gt;$key = $val;
      }
      function __destruct()
      {
          $_SESSION['FLASH']=null;
      }
  }
  </code></pre>
  
  <p>also i have Controller child class Home, where functions are run by route, like /Home/Index  => public function index()</p>
  
  <pre><code>class Home extends Controller
  {
      function __construct()
      {
          parent::__construct();
      }
  
      public function index()
      {
          //where i want to display $this-&gt;message only once
          echo $this-&gt;message; // but $this-&gt;message is undefinded why? 
      }
      public function Post_register(){
          //after post form data
          // validation 
  
          // this function redirect to /Home/Index  above function index();
          Uri::redirectToAction("Home","Index",array('message' =&gt; 'some message'));
      }
  }
  </code></pre>
  
  <p>and uri class function where i redirecting user.</p>
  
  <pre><code>public static function redirectToAction($controller,$method,$arr)
  {
      $_SESSION['FLASH'] = $arr;
      header("Location:/".$controller.'/'.$method);
  }
  </code></pre>
  
  <p>but <code>$this-&gt;message</code> is undefinded why?</p>