不能声明 class 常量或 属性 变量
Can't declare class constant nor property variable
class Model {
public $DATABASE_NAME = 'dealer-kunde-skuska';
// OR
const DATABASE_NAME = 'dealer-kunde-skuska';
}
None 以上声明有效。它returns错误:
Parse error: parse error, unexpected T_STRING, expecting T_OLD_FUNCTION or T_FUNCTION or T_VAR or '}' in ... on line 5
有什么问题吗?
public
和 const
仅适用于 PHP 5。var
用于 PHP 4.
Support for PHP 4 has been discontinued since 2007-12-31. Please consider upgrading to PHP 5.
也许升级? PHP 5 已推出 11 年,PHP 4 已停产 7。
class Model {
public $DATABASE_NAME = 'dealer-kunde-skuska';
// OR
const DATABASE_NAME = 'dealer-kunde-skuska';
}
None 以上声明有效。它returns错误:
Parse error: parse error, unexpected T_STRING, expecting T_OLD_FUNCTION or T_FUNCTION or T_VAR or '}' in ... on line 5
有什么问题吗?
public
和 const
仅适用于 PHP 5。var
用于 PHP 4.
Support for PHP 4 has been discontinued since 2007-12-31. Please consider upgrading to PHP 5.
也许升级? PHP 5 已推出 11 年,PHP 4 已停产 7。