Variables Kohana控制器操作共享变量

Variables Kohana控制器操作共享变量,variables,controller,kohana,global,shared,Variables,Controller,Kohana,Global,Shared,我想写一个变量来访问同一个控制器中的任何操作。我编写一个共享或全局变量 我使用的是Kohana 3.1 这是可能的!?我找不到任何有相同问题的示例或人员。使用类属性如何 <?php defined('SYSPATH') or die('No direct script access.'); class Controller_Application extends Controller_Base { public $variable = FALSE; /* Th

我想写一个变量来访问同一个控制器中的任何操作。我编写一个共享或全局变量

我使用的是Kohana 3.1


这是可能的!?我找不到任何有相同问题的示例或人员。

使用类属性如何

<?php defined('SYSPATH') or die('No direct script access.'); 

class Controller_Application extends Controller_Base {
      public $variable = FALSE;

      /* This will echo true */
      public function action_index()
      {
            $this->variable = TRUE;
            echo Debug::vars($this->variable);
      }

      /* This will echo false */
      public function action_variable()
      {
            echo Debug::vars($this->variable);
      }
}