我有一个如下的 PHP 类
<?php
class Test{
var $conf = array('a' => 1, 'b' => 2, c => 3);
private function do_something(){
// Do something Here
function do_something_else(){
// How to get the variable value for $conf ???? o.O
}
}
}
?>
我想访问$conf
函数内部do_something_else()
。在上层函数中,我可以将其作为 访问$this->conf
,但我想$this
在内部函数中将不可用。访问该函数内的变量的最佳方法是什么?
我无法传递值,因为该函数将由 WordPress CMS 中的内置函数调用,因此此处不能选择传递参数。