我努力学习OOP和我做了这个类PHP - 传递变量的类
class boo{
function boo(&another_class, $some_normal_variable){
$some_normal_variable = $another_class->do_something();
}
function do_stuff(){
// how can I access '$another_class' and '$some_normal_variable' here?
return $another_class->get($some_normal_variable);
}
}
,我把这个地方的another_class
类中像
$bla = new boo($bla, $foo);
echo $bla->do_stuff();
但我不知道如何访问do_stuff函数内部$ BLA,$ foo的
*(参考)* [类和对象基础知识(HTTP:// WWW .php.net/manual/en/language.oop5.basic.php) – Gordon 2011-02-02 17:45:24
阅读http://docs.php.net/this上的$ this! – rik 2011-02-02 17:47:22