mysql_client_encoding
Returns the name of the currently connected character set.
Function name: mysql_client_encoding()
Applicable version: PHP 4 >= 4.0.6, PHP 5, PHP 7
Usage: The mysql_client_encoding() function is used to obtain the character set encoding of the currently connected MySQL client.
Syntax: string mysql_client_encoding ( [resource $link_identifier = NULL] )
parameter:
Return value: Returns the MySQL client character set encoding of the current connection, and returns false if the connection is not opened.
Example:
// 创建MySQL 连接$link = mysql_connect("localhost", "username", "password"); // 检查连接是否成功if (!$link) { die("连接数据库失败:" . mysql_error()); } // 获取当前连接的MySQL 客户端字符集编码$encoding = mysql_client_encoding($link); // 打印结果echo "当前连接的MySQL 客户端字符集编码是:" . $encoding; // 关闭连接mysql_close($link);
Notes: