首页 > > > php连接mssql的疑问
<?php
$serverName = "serverName\sqlexpress"; //serverName\instanceName
// Since UID and PWD are not specified in the $connectionInfo array,
// The connection will be attempted using Windows Authentication.
$connectionInfo = array( "Database"=>"dbName");
$conn = sqlsrv_connect( $serverName, $connectionInfo);
if( $conn ) {
echo "Connection established.<br />";
}else{
echo "Connection could not be established.<br />";
die( print_r( sqlsrv_errors(), true));
}为啥连接只需要提供服务器名字就可以,连接本机的和内网或者外网的服务器都是这样吗?
给个名字就能找到要连的原理是啥?
来自 “ ITPUB博客 ” ,链接:https://blog.itpub.net/4809/viewspace-3167644/ ,如需转载,请注明出处,否则将追究法律责任。