PHP之数据库连接配置文件

时间:2021-02-01 11:59:45
<?php
	$config=array(
		'host' =>'localhost',
		'port'=>'3306',
		'db' =>'localhost',
		'db_user' =>'root',
		'db_psw' =>'',
		'db_name' =>'test'
	);
	$connID=@mysqli_connect($config['host'],$config['db_user'],$config['db_psw'],$config['db_name'],$config['port']);
	if(!$connID){
		echo("数据库连接失败");
	}
?>