【发布时间】:2011-06-20 03:44:08
【问题描述】:
我正在尝试学习 OOP,并且我已经完成了这门课程
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
【问题讨论】:
-
在docs.php.net/this 上了解
$this!