Linux中的CakePHP错误

Jcb*_*cbo 1 cakephp

我在CakePHP中开发了一个应用程序--Windows.

然后我把它放在Ubuntu中并进行必要的设置.一切都有效,除了线:

$this-> set (
    'projeto_id', 
    $this-> requestAction (
        "/Projects/getprojectsofcategory", 
        array (
            'setor_id' => $this->Registration-> read()['Registration']['setor_id'] 
        )
    )
);
Run Code Online (Sandbox Code Playgroud)

给我以下错误:

致命错误错误:语法错误,意外'[',期待')'

而且我不明白为什么.如果我注释掉该行会出现以下错误,因为它属于同一类型.

有人能解释一下为什么会出现这个错

Nun*_*ser 5

您需要升级到较新版本的PHP,否则您将需要更改功能.

查看这篇文章中投票最多的答案.$this->Registration->read()['Registration']不适用于PHP <5.4

如果你不能升级php,你需要有一个中间变量

$valueRead = this->Registration->read();

$this-> set (
'projeto_id', 
$this-> requestAction (
    "/Projects/getprojectsofcategory", 
    array (
        'setor_id' => $valueRed['Registration']['setor_id'] 
    )
)
);
Run Code Online (Sandbox Code Playgroud)