PHP中Microsoft SQL Server的连接参数

佩佩穆吉卡

我正在尝试使用PHP连接到Microsoft SQL Server

为了在sql management studio中使用镜像数据库,我使用“其他连接参数”标签中的“ ApplicationIntent = ReadOnly”。

如何在php中设置此参数?

没有参数的连接方式示例:

$serverName = "server, port";
$connectionInfo = array( "Database"=>"my_db");
$conn = sqlsrv_connect( $serverName, $connectionInfo);
砷化镓

您可以将其作为选项之一传递,如下所示:

sqlsrv_connect($serverName, ['ApplicationIntent' => 'ReadOnly']);

或您的情况:

$serverName = "server, port"; 
$connectionInfo = array('Database' => 'my_db', 'ApplicationIntent' => 'ReadOnly'); 
$conn = sqlsrv_connect( $serverName, $connectionInfo);

另请参见php docs中的sqlsrv_connect()

本文收集自互联网,转载请注明来源。

如有侵权,请联系 [email protected] 删除。

编辑于
0

我来说两句

0 条评论
登录 后参与评论

相关文章