• 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
how to access variable from a file

#1
[eluser]ranjitbd[/eluser]
Code:
access variable and method

// we can load a library by following code

    $this->load->library('encrypt');

// suppose $abc is a variable and xyz() is a method exist in eccrypt file
// we can access the method by following code

    $this->encrypt->xyz();

// how can i access the variable $abc from encrypt file.and imagine that $abc is not
//inside the xyz() method

//then what will be the code

#2
[eluser]umefarooq[/eluser]
you can access same as you are accessing library function

$this->encrypt->abc = $def;

you have to define you variable in you library class as public you can access any where in you application

#3
[eluser]ranjitbd[/eluser]
[quote author="umefarooq" date="1251892066"]you can access same as you are accessing library function

$this->encrypt->abc = $def;

you have to define you variable in you library class as public you can access any where in you application[/quote]
Code:
//where you got the $def?


Digg   Delicious   Reddit   Facebook   Twitter   StumbleUpon  


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