<?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));
}為啥連接只需要提供服務(wù)器名字就可以,連接本機(jī)的和內(nèi)網(wǎng)或者外網(wǎng)的服務(wù)器都是這樣嗎?給個(gè)名字就能找到要連的原理是啥?
php連接mssql的疑問(wèn)
呼喚遠(yuǎn)方
2018-08-03 06:30:50