PHP mysqli_get_server_info() 関数

❮ PHP MySQLi リファレンス

MySQLサーバのバージョンを返します:

<?php
$con=mysqli_connect("localhost","my_user","my_password","my_db");
// Check connection
if (mysqli_connect_errno())
  {
  echo "Failed to connect to MySQL: " . mysqli_connect_error();
  }

echo mysqli_get_server_info($con);

mysqli_close($con);
?>

定義と用法

mysqli_get_server_info() 関数は、MySQLサーバのバージョンを返します。


構文

mysqli_get_server_info(connection);

パラメータ 説明
connection 必須。使用する MySQL 接続を指定する

技術内容
返り値: MySQLサーバのバージョンを表す文字列を返します
PHP バージョン: 5+

❮ PHP MySQLi リファレンス