将D:\wamp\bin\php\php5.5.12\ext路径下
这两个文件复制到php.ini中
链接数据库方法
<?php $serverName = ".";
$connectionInfo = array( "Database"=>"yunjianyan", "UID"=>"sa", "PWD"=>"123");
$conn = sqlsrv_connect( $serverName, $connectionInfo );
if( $conn === false )
{
die( print_r( sqlsrv_errors(), true));
}
$sql = "SELECT * FROM users";
$stmt = sqlsrv_query( $conn, $sql );
if( $stmt === false)
{
die( print_r( sqlsrv_errors(), true) );
}
while($row = sqlsrv_fetch_array($stmt))
{
echo $row[0]."-----".$row[1]."-----".$row[2]."-----".$row[3]."<br/>";
}