sqlsrv_client_info

下載 PHP 驅動程式

傳回連接和用戶端堆疊的相關資訊。

語法

  
sqlsrv_client_info( resource $conn)  

參數

$conn:用以連接用戶端的連接資源。

傳回值

下表中說明、具有索引鍵的關聯陣列;如果連接資源為 Null,則為 false

若是 SQL Server 3.2 和 3.1 版的 PHP

Key 描述
DriverDllName MSODBCSQL11.DLL (ODBC Driver 11 for SQL Server)
DriverODBCVer ODBC 版本 (xx.yy)
DriverVer ODBC Driver 11 for SQL Server DLL 版本:

xx.yy.zzzz (Microsoft Drivers for PHP for SQL Server 3.2 版或 3.1 版)
ExtensionVer php_sqlsrv.dll 版本:

3.2.xxxx.x (適用於 Microsoft Drivers for PHP for SQL Server 3.2 版)

3.1.xxxx.x (適用於 Microsoft Drivers for PHP for SQL Server 3.1 版)

若是 SQL Server 3.0 和 2.0 版的 PHP

Key 描述
DriverDllName SQLNCLI10.DLL (Microsoft Drivers for PHP for SQL Server 2.0 版)
DriverODBCVer ODBC 版本 (xx.yy)
DriverVer SQL Server Native Client DLL 版本:

10.50.xxx (Microsoft Drivers for PHP for SQL Server 2.0 版)
ExtensionVer php_sqlsrv.dll 版本:

2.0.xxxx.x (Microsoft Drivers for PHP for SQL Server 2.0 版)

範例

從命令列執行下列範例時,該範例會將用戶端資訊寫入至主控台。 此範例假設 SQL Server 安裝在本機電腦上。 從命令列執行範例時,所有輸出都會寫入至主控台。

<?php  
/*Connect to the local server using Windows Authentication and   
specify the AdventureWorks database as the database in use. */  
$serverName = "(local)";  
$conn = sqlsrv_connect( $serverName);  
  
if( $conn === false )  
{  
     echo "Could not connect.\n";  
     die( print_r( sqlsrv_errors(), true));  
}  
  
if( $client_info = sqlsrv_client_info( $conn))  
{  
       foreach( $client_info as $key => $value)  
      {  
              echo $key.": ".$value."\n";  
      }  
}  
else  
{  
       echo "Client info error.\n";  
}  
  
/* Close connection resources. */  
sqlsrv_close( $conn);  
?>  

另請參閱

SQLSRV 驅動程式 API 參考

關於文件中的程式碼範例