Home >Backend Development >PHP Tutorial >PHP连接sqlserver2008,如何连接指定ip地址上的数据库
PHP连接sqlserver2008,怎么连接指定ip地址上的数据库
$serverName = "(local)"; //数据库服务器地址<br />$uid = "sa"; //数据库用户名<br />$pwd = "password123"; //数据库密码<br />$connectionInfo = array("UID"=>$uid, "PWD"=>$pwd, "Database"=>"test");<br />$conn = sqlsrv_connect( $serverName, $connectionInfo);<br />if( $conn == false)<br />{<br /> echo "连接失败!";<br /> die( print_r( sqlsrv_errors(), true));<br />}<br />if($conn){<br />echo "连接成功";<br />}