PHP mysqli_character_set_name() 函数
PHP 教程
· 2019-01-27 17:13:04
实例
返回数据库连接的默认字符集:
<?php
$con=mysqli_connect("localhost","my_user","my_password","my_db");
// 检查连接
if (mysqli_connect_errno($con))
{
echo "连接数据库失败: " . mysqli_connect_error();
}
$charset=mysqli_character_set_name($con);
echo "默认字符集为: " . $charset;
mysqli_close($con);
?>
$con=mysqli_connect("localhost","my_user","my_password","my_db");
// 检查连接
if (mysqli_connect_errno($con))
{
echo "连接数据库失败: " . mysqli_connect_error();
}
$charset=mysqli_character_set_name($con);
echo "默认字符集为: " . $charset;
mysqli_close($con);
?>
定义和用法
mysqli_character_set_name() 函数返回数据库连接的默认字符集。
语法
mysqli_character_set_name(connection);
| 参数 | 描述 |
|---|---|
| connection | 必需。规定要使用的 MySQL 连接。 |
技术细节
| 返回值: | 指定连接的默认字符集。 |
|---|---|
| PHP 版本: | 5+ |
点击查看所有 PHP 教程 文章: https://codercto.com/courses/l/5.html
The Art of Computer Programming, Volume 2
Knuth, Donald E. / Addison-Wesley Professional / 1997-11-04 / USD 79.99
Finally, after a wait of more than thirty-five years, the first part of Volume 4 is at last ready for publication. Check out the boxed set that brings together Volumes 1 - 4A in one elegant case, and ......一起来看看 《The Art of Computer Programming, Volume 2》 这本书的介绍吧!