Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
我有多个使用不同的 $db_prefix 运行一个 MySQL 数据库的 drupal 站点。
如果我使用不同的数据库,我可以通过将它们放在 settings.php 中的数组中来共享数据,然后根据需要调用特定的数据库。
是否可以通过调用不同的 $db_prefix 来实现?
您可以在不同站点之间共享单个表,您可以通过将 db_prefix 设为这样的数组来做到这一点;
$db_prefix = array( 'default' => 'site_a_', 'users_roles' => 'site_b_', 'role' => 'site_b_', 'sessions' => 'site_b_', 'users' => 'site_b_' );
如果这是在站点 A 的 settings.php 中,那么它将与站点 B 共享它的 user_roles、角色、会话和用户表。
这是你想要的吗?