define();
今日は、変数をデータベースに接続するのが賢明かどうかを尋ねるためにここにいます。私の例は次のとおりです。
// Constants For Database
define ("DBAHost", "localhost");
define ("DBAUsername", "xxx");
define ("DBAPassword", "xxx");
define ("DBADB", "xxx");
および処理された接続。
class ClassWork
{
public function AllowDB ($Arg1)
{
if ($Arg1 === 1)
{
$MySQLi = new mysqli(DBAHost, DBAUsername, DBAPassword, DBADB);
return 'Success... ' . mysqli_get_host_info($MySQLi);
}
elseif ($Arg1 !== 1)
{
return 'Wrong Argument Please Consult The Documentation!';
}
}
}
それとも、受け入れデータベース接続文字列を変更して、パブリック関数をプッシュしますか?