PHP 意外的T_FUNCTION/构造问题


PHP unexpected T_FUNCTION/construct issue?

我在蛋糕 php 中有代码,看起来像:

public $ceff_instance = array();
public function __construct() {
    $this->ceff_instance = $this->wsMethod_GO();
}
protected $filedMethodMappings = $this->$ceff_instance;

其中$wsMethod_GO返回一个数组。但是,它说行上有一条unexpected T_FUNCTION,我尝试将$ceff_instance数组放入$filedMethodMappings。这是什么原因呢?

我一辈子都想不通。

protected $filedMethodMappings = $this->$ceff_instance;

不能在方法外部设置使用$this

public $ceff_instance = array();
protected $filedMethodMappings = NULL;
public function __construct() {
    $this->ceff_instance = $this->wsMethod_GO();
    $this->filedMethodMappings = $this->$ceff_instance;
}

演示:http://codepad.org/1V6ChkY0