Cake Php,获取数据库访问权限和供应商文件夹中的“配置”方法

How to get database acess inside files in vendors folder(app/vendors) in Cake Php, get mysql connected via database.php (Cake structure) .

How to get Configure method inside vendors folder(app/vendors), when we want to set a constant in core.php by Configure.write method .

I created a file 'testvideo.php' inside vendors folder (app/vendors/ZendGdata/library/testvideo.php)

I want to get acess of my databse from this file and Configure method.

I would reconsider your design if you need to access the database from your vendors folder. But in any case, you could do the following:

require_once('config/database.php');
$dbConfig = new DATABASE_CONFIG();
$dblink = mysqli_connect($dbConfig->default['host'], $dbConfig->default['login'], $dbConfig->default['password'], $dbConfig->default['database']);

I would pass the configuration variables to your vendor object instead of reading the configuration from the vendor side. ie:

App::import('Vendor', 'facebook', array('file' => 'facebook/facebook.php'));
    $facebook = new Facebook(array(
      'appId'  => Configure::read("FB_APP_ID"),
      'secret' => Configure::read("FB_APP_SECRET"),
    ));