我想访问位于插件app/config/database.php
内的app/Plugin/Myplugin/bootstrap.php
的DATABASE_CONFIG类值
class DATABASE_CONFIG {
public $redis = array(
'datasource' => 'Redis.RedisSource',
'host' => '127.0.0.1',
'port' => '6379',
'db' => '2'
);
}
我想访问$redis
Myplugin
主机和端口
编辑:CAKEPHP版本是2.1.2
答案 0 :(得分:2)
获取数据库详细信息: -
App::uses('ConnectionManager', 'Model');
$dataSource = ConnectionManager::getDataSource('redis');
$host = $dataSource->config['host'];
$port = $dataSource->config['port'];