Welcome Guest, Not a member yet? Register   Sign In
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?




Theme © iAndrew 2016 - Forum software by © MyBB