我在类中声明为数组的public
变量,在类中本地使用但我无法在类外使用它。
下面是代码
class permissions {
public static $departments = array(
"Engineering"=>array(
'ONM','ESS','NP','NC','Engineering'
)
);
// remaining code is left out for brevity
}
我如何在课堂声明中访问$department
?
我期待这种方式permissions::departments;
,但收到错误Undefined class constant 'departments'
。