0
我面临着一些困难,使静态数组变量静态数组PHP,给一些类的静态属性为静态数组的按键,这样的事情:声明做出与
class A {
private $ambito; //will be filled with an element of the static $ambitos
public static $municipal = 1;
public static $provincial = 2;
public static $regional = 3;
/*array para declarar los posibles ambitos de visualizacion de una empresa*/
private static $ambitos = array(
self::$municipal => "Municipal",
self::$provincial => "Provincial",
self::$regional => "Regional"
);
public static function getAmbitos()
{
return self::$ambitos;
}
}
的问题是我不能在静态数组中使用self:$ municipal,因为它引发了错误,我只能使用文字整数(我是如何保存在数据库中的)
我正在使用symphony 2.0。
谢谢!
谢谢!我不能投票给你,因为我没有足够的声望,但它完美无缺;) – Angel 2013-04-11 11:14:19