我只是将我的博客移至 appfog。我目前正在使用 cakephp 1.3.x。我知道我需要升级,我已经在努力了。但与此同时,我想让我的博客正常工作。我无法配置数据库文件。
我知道我们需要添加
$services_json = json_decode(getenv('VCAP_SERVICES'),true);
$af_mysql_config = $services_json['mysql-5.1'][0]['credentials'];
// Database settings
Configure::write('Database.config', array(
'default' => array(
'datasource' => 'Database/Mysql',
'persistent' => false,
'host' => $af_mysql_config['hostname'],
'login' => $af_mysql_config['username'],
'password' => $af_mysql_config['password'],
'database' => $af_mysql_config['name'],
'prefix' => '',
'encoding' => 'utf8',
)
));
我只想知道我们如何将设置发送到数据库配置。
我很感激任何帮助。