安裝好php的sqlsrv模塊
//本地連接
$serverName = "CX95DLISVW4C6TKaaa";//計算機名實例名
$connectionInfo = array("Database"=>"fff","ConnectionPooling"=>'',' UID'=>'sa','PWD'=>'123');
$conn = sqlsrv_connect( $serverName, $connectionInfo);
if( $conn == false)
{
die( print_r( sqlsrv_errors(), true));
}else{
echo "dfdf";
$query=sqlsrv_query($conn,"selectlecto from dlif"; $query)){
print_r($row);
}
//print_r($query);
}
//遠端連線
$serverName = "192.1688com =>"CIA","ConnectionPooling"=>'','UID'=>'sa','PWD'=>'360kad.com');
$conn = sqlsrv_connect( $serverName, $connectionInfo);
if ( $conn == false)
{
echo "連結失敗!";
die( print_r( sqlsrv_errors(), true));
}else{ select * from CodeSiteTaker_Model");
while($row = sqlsrv_fetch_array($query)){
print_r($row);