|
 |
mysqli_character_set_name (PHP 5) mysqli_character_set_name (no version information, might be only in CVS) mysqli->character_set_name -- Returns the default character set for the database connection DescriptionProcedural style: string mysqli_character_set_name ( mysqli link ) Object oriented style (method): class mysqli { string character_set_name ( void ) }
Returns the current character set for the database connection specified by the
link parameter.
返回值The default character set for the current connection 例例子 1. Object oriented style
<?php
$mysqli = new mysqli("localhost", "my_user", "my_password", "world");
if (mysqli_connect_errno()) {
printf("Connect failed: %s\n", mysqli_connect_error());
exit();
}
$charset = $mysqli->character_set_name();
printf ("Current character set is %s\n", $charset);
$mysqli->close();
?>
|
|
例子 2. Procedural style
<?php
$link = mysqli_connect("localhost", "my_user", "my_password", "world");
if (!$link) {
printf("Connect failed: %s\n", mysqli_connect_error());
exit();
}
$charset = mysqli_character_set_name($link);
printf ("Current character set is %s\n",$charset);
mysqli_close($link);
?>
|
|
上例将输出: Current character set is latin1_swedish_ci |
| |