我班上有一个私有变量
private $noms = array(
"HANNY",
"SYS",
"NALINE"
);
Run Code Online (Sandbox Code Playgroud)
我想从静态方法访问它:
public static function howManyNom($searchValue){
$ar = $this->noms;
foreach($ar as $key => $value) {
...
Run Code Online (Sandbox Code Playgroud)
但正常情况下,我无法使用$ this检索它,因为静态方法上没有实例.
在我的静态函数中获取$ noms的正确语法是什么?
tux*_*imo 19
使这个属性也是静态的!
private static $noms = array(
"HANNY",
"SYS",
"NALINE"
);
public static function howManyNom($searchValue){
$ar = self::$noms;
foreach($ar as $key => $value) {
Run Code Online (Sandbox Code Playgroud)