Rog*_*ger 5 php azure azure-sql-database
我正在尝试通过PHP连接从php到Azure DB
$connectionInfo = array("UID" => "xxx@xxx", "pwd" => "xxx", "Database" => "xxx");
$serverName = "tcp:xxx.database.windows.net,1433";
$conn = sqlsrv_connect($serverName, $connectionInfo);
Run Code Online (Sandbox Code Playgroud)
但它给了我
致命错误:在第19行的C:\ wamp\www ...\index.php中调用未定义的函数sqlsrv_connect()
你必须首先使用PHP的SQL Server本机驱动程序,然后你可以做类似的事情:
$serverName = "tcp:sample.database.windows.net, 1433";
$connectionOptions = array("Database" => "sampleInit",
"UID" => "sampleUsr@sample",
"PWD" => "samplePass",
"MultipleActiveResultSets" => false);
$conn = sqlsrv_connect($serverName, $connectionOptions);
if($conn === false)
{
die(print_r(sqlsrv_errors(), true));
}
Run Code Online (Sandbox Code Playgroud)
您可以在以下博客文章中阅读有关PHP和SQL Azure的更多信息:http:
//blogs.msdn.com/b/brian_swan/archive/2010/02/12/getting-started-with-php-and-sql-azure. ASPX
归档时间: |
|
查看次数: |
34486 次 |
最近记录: |