Latest web development tutorials

PHP mysqli_get_charset () function

PHP MySQLi Reference Manual PHP MySQLi Reference Manual

Examples

Returns the character set object with attributes:

<?php
$con=mysqli_connect("localhost","my_user","my_password","my_db");
// 检测连接
if (mysqli_connect_errno($con))
{
    echo "数据库连接失败: " . mysqli_connect_error();
}

var_dump(mysqli_get_charset($con));

mysqli_close($con);
?>

Definition and Usage

mysqli_get_charset () function returns the character object.


grammar

mysqli_get_charset( connection ) ;

参数 描述
connection 必需。规定要使用的 MySQL 连接。

technical details

return value: Returns the character set object with the following properties:
  • charset - charset name
  • collation - collation name
  • dir - directory of the character set to be acquired or ""
  • min_length - in bytes minimum character length
  • max_length - in bytes maximum length
  • number - the number of internal character set
  • state - the state of the character set
PHP version: 5.1+


PHP MySQLi Reference Manual PHP MySQLi Reference Manual