php5.6(xampp,phpstudy测试通过) lavarel
1.打开php.ini 修改 ;extension=php_pdo_xxx.dll 去掉前面的;号
php.ini中增加:(非官方的64位版本)对应php/ext/下面放这两个文件(链接: http://pan.baidu.com/s/1jI7SOcQ 密码: 55js)
extension=php_sqlsrv_56_ts_vc6.dll
extension=php_pdo_sqlsrv_56_ts_vc6.dll
2.安装mssql驱动(链接: http://pan.baidu.com/s/1nvaCBih 密码: xm9p)
3.测试,连接代码:
关键代码:sqlsrv_connect($serverName, $connInfo);
完整代码:
header("Content-Type: text/html; charset=utf-8");
$serverName = "192.168.1.2";
$connInfo = array("Database"=>"JolinkCS_2016_10_09", "UID"=>"sa", "PWD"=>"sxjlinc_2012");
$conn = sqlsrv_connect($serverName, $connInfo);
if($conn){
echo "连接成功!
";
}else{
echo "连接失败!
";
die( print_r(sqlsrv_errors(), true));
}