除了谈论很多无用的东西之外,还有我的代码:
1 public static $_INT = 'INTEGER';
2 protected $_name = 'projetos';
3 protected $_primary = 'id';
4 protected $_fields = Array (
Array ('id', self::$_INT)
);
我在第4行有个错误。
self::$_INT
是一个表达式,不能在类中的属性声明中使用表达式,只能使用静态值。
如果你想这样做,你必须在构造函数中初始化$_fields
。
像
class MyClass {
public static $_INT = 'INTEGER';
protected $_name = 'projetos';
protected $_primary = 'id';
protected $_fields;
public function __construct() {
$this->fields = Array (
Array ('id', self::$_INT)
);
}
}