1

CakePHP - Windows でアプリケーションを開発しました。

次に、Ubuntuに入れ、必要な設定を行いました。次の行を除いてすべてが機能します。

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

次のエラーが表示されます。

致命的なエラー エラー: 構文エラー、予期しない '['、')' が必要です

理由がわかりません。コメントアウトすると、同じジャンルであるため、次のエラーが発生します。

誰かがこのエラーの理由を説明できますか?

4

1 に答える 1

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'] 
    )
)
);
于 2013-06-26T20:47:15.790 に答える