別の関数によって更新されたパブリックコントローラー変数の値にアクセスする方法を知っている人はいますか? コード例 コントローラー
class MyController extends CI_Controller {
public $variable = array();
function __construct() {
parent::__construct();
}
function index(){
$this->variable['name'] = "Sam";
$this->variable['age'] = 19;
}
function another_function(){
print_r($this->variable);
}
}
another_function() を呼び出すと、空の配列が返されます..何が問題なのですか? どんな助けも高く評価されます..