3
这里是我的代码:为什么初始化属性不起作用?
class Log
{
private $mode = config('my.log.mode');
}
但它抛出语法错误 ..!为什么?怎么了?
注意到这个作品,以及:
class Log
{
private $mode;
public function __construct()
{
$this->mode = config('my.log.mode');
}
}
好,有什么意义?
..或PHP 5.6的标量表达式:http://docs.php.net/manual/en/migration56.new-features.php#migration56.new-features.const-scalar-exprs – simon