我正在编写一个为我编译的laravel脚本。经历我决定创建两个域,访问相同的脚本,但调用不同的数据库。我不太了解laravel,我不相信我可以重新编译代码,但这是当前的数据库调用:
<?php
return array('db_host' => 'mysql.com', 'db_name' => 'database', 'db_user' => 'myusername', 'db_password' => 'password123');
我正在尝试做类似这样的代码:
<?php $url = Request::url();
if (strpos($url, "greymafia")!==false){
return array('db_host' => 'mysql.com', 'db_name' => 'database', 'db_user' => 'myusername', 'db_password' => 'password123');
}
if (strpos($url, "pinvy")!==false){
return array('db_host' => 'mysql.com', 'db_name' => 'database', 'db_user' => 'myusername', 'db_password' => 'password123');
}