• 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
global variable in controllers

#2
[eluser]Learn CodeIgniter[/eluser]
Code:
class Main extends CI_Controller {

  public $v;

  function __construct()
  {
    parent::__construct();

    $this->v = "23";
  }

  function index()
  {
    echo $this->v; // doesnt work, undefined var
  }
}


Messages In This Thread
global variable in controllers - by El Forum - 06-04-2012, 01:39 PM
global variable in controllers - by El Forum - 06-04-2012, 02:25 PM

Digg   Delicious   Reddit   Facebook   Twitter   StumbleUpon  


  Theme © 2014 iAndrew  
Powered By MyBB, © 2002-2021 MyBB Group.