0
私はdrupal8の開発者です。モジュール内の他の外部データベースに接続したい同様にD7では次のようになります。カスタムモジュールの実行時に外部データベースをdrupalに接続する方法8
$other_database = array(
'database' => 'databasename',
'username' => 'username', // assuming this is necessary
'password' => 'password', // assuming this is necessary
'host' => 'localhost', // assumes localhost
'driver' => 'mysql', // replace with your database driver
);
// replace 'YourDatabaseKey' with something that's unique to your module
Database::addConnectionInfo('YourDatabaseKey', 'default', $other_database);
db_set_active('YourDatabaseKey');
// execute queries here
db_set_active(); // without the paramater means set back to the default for the site
drupal_set_message(t('The queries have been made.'));
これをD8で試しましたが、エラーが発生しています。この点で私を助けてくれますか?