Mysqli-error-get-charset

提供:Dev Guides
移動先:案内検索

MySQLi-文字セットを取得

構文

object mysqli_get_charset ( mysqli $link )

定義と使い方

文字セットオブジェクトを返します。

次の例を試してください-

<?php
   $db = mysqli_init();
   $servername = "localhost:3306";
   $username = "root";
   $password = "";
   $dbname = "TUTORIALS";

   $conn = mysqli_real_connect($db,$servername, $username, $password, $dbname);
   var_dump(mysqli_get_charset($db));
?>

上記のコードのサンプル出力は次のようになります-

object(stdClass)#2 (8) {
   ["charset"]=> string(6) "latin1" ["collation"]=> string(17) "latin1_swedish_ci"
   ["dir"]=> string(0) "" ["min_length"]=> int(1) ["max_length"]=> int(1)
   ["number"]=> int(8) ["state"]=> int(1) ["comment"]=> string(0) ""
}