Drupal7链接到多个数据库
来源:互联网 发布:ios 广告拦截 知乎 编辑:程序博客网 时间:2024/05/17 22:11
n Drupal 7, first construct a database connection array, then connect to it to Drupal's front-controller, then execute queries using D7's database abstraction layer.
<?php
$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.'));
?>
- Drupal7链接到多个数据库
- drupal7 通过数据库设置默认主题
- drupal7 根据不同的 域名,修改首页链接地址
- 就这一个链接让你搞懂drupal7的hook
- drupal7 如何自定义内容部链接,并预留hook接口(自定义视图字段比较有用)
- 数据库链接
- 数据库链接
- 数据库链接
- 链接数据库
- 数据库链接
- 数据库链接
- 数据库链接
- 链接数据库
- 链接数据库
- 数据库链接
- 链接数据库
- 数据库链接
- 数据库链接
- 如何在log4j.properties文件中使用相对路径
- Android app widget 支持的Layout和widget组件
- mpc使用介绍(四)
- 局域网聊天(UDP)
- WebService简介
- Drupal7链接到多个数据库
- mpc使用介绍(五)
- 【转】 Android转屏时禁止调用onCreate
- 下载积分
- 运营商代扣在移动支付中的作用
- 代码随笔——点阵汉字在LCD上的显示
- Android Monkey 测试
- 冷笑话一则
- 猜数字小游戏(MiniGUI)