php - using static variable in different controller -
i'm making application i'm saving user information in user controller of code igniter application inside static variable, want access static variable in other controller, how can approach that? code here
<?php class user extends ci_controller{ public static $user_data = array(); public __construct() { parent::__construct(); self::$user_data = array('value'); // values model } } // can user static variable view in controller class friends extends ci_controller{ public __construct() { parent::__construct(); if(user::$user_data->isfriends) { redirect('person/'.user::$user_data->id); } } } // how can access functionality in codeigniter? gives error undefined class user not found
static::$user_data = array('value')
shouldn't self::... in user class?
Comments
Post a Comment