例如:我有两个应用程序(App1和App2)但两者都有不同的登录名。每个应用程序都以以下或类似的方式开始
include ("/config/yourcreds.php");
$mysqlconnect = mysqli_connect($host, $user, $pass, $database)
or die ("Sorry, There was an issue connecting to database");
,配置文件应该是这样的:
CREDS1: $host="localhost", $pass="pass1", $user="user1", $database="database1"
CREDS2: $host="localhost", $pass="pass2", $user="user2", $database="database2"
我意识到我只是因为不使用而变得复杂:
$host="localhost"
$user1="user1"
$pass1="pass1"
$database1="database1"
$user1="user2"
$pass1="pass2"
$database1="database2"
但我喜欢在我的所有应用程序中选择统一开发凭据的想法......这样的事情可以用PHP完成吗?