MySQLi - Get Charset

语法

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) "" 
}

mysqli_useful_functions.html