[英]enable pdo_sqlsrv in php 7.2, not working
I have followed all the guided path,我已经遵循了所有的引导路径,
I need to know, is it the version issue or I missed out something.我需要知道,是版本问题还是我错过了什么。
Installation of PHP Driver for SQL Server can be done following the next steps:可以按照以下步骤安装 SQL Server 的 PHP 驱动程序:
Example:例子:
<?php
# Info
$server = 'server\instance,port';
$database = 'database';
$username = 'username';
$password = 'password';
# Connect
try {
$conn = new PDO("sqlsrv:server=$server;Database=$database", $username, $password);
$conn->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);
} catch(PDOException $e) {
die("Error connecting to SQL Server".$e->getMessage());
}
# End
echo 'Connected';
$conn = null;
?>
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.