出于某种原因,这给了我以下错误syntax error, unexpected T_VARIABLE
::
$mysql = json_decode(getenv("VCAP_SERVICES"));
$mysql = $mysql["mysql-5.1"][0]["credentials"];
class DATABASE_CONFIG {
public $default = array(
'datasource' => 'Database/Mysql',
'persistent' => false,
'host' => 'localhost',
'port' => $mysql['port'], // <-- Line with error
'login' => $mysql['username'],
'password' => $mysql['password'],
'database' => $mysql['name'],
'prefix' => ''
//'encoding' => 'utf8',
);
public $test = array(
'datasource' => 'Database/Mysql',
'persistent' => false,
'host' => 'localhost',
'login' => 'user',
'password' => 'password',
'database' => 'test_database_name',
'prefix' => '',
//'encoding' => 'utf8',
);
}
我知道您可以将变量用作数组中的值,那么发生了什么?