mysqli::character_set_name

mysqli_character_set_name

(PHP 5, PHP 7)

mysqli::character_set_name -- mysqli_character_set_nameReturns the default character set for the database connection

Opis

Styl obiektowy

mysqli::character_set_name ( void ) : string

Styl proceduralny

mysqli_character_set_name ( mysqli $link ) : string

Returns the current character set for the database connection.

Parametry

połączenie

Tylko styl proceduralny: Identyfikator połączenia zwrócony przez mysqli_connect() lub mysqli_init()

Zwracane wartości

The default character set for the current connection

Przykłady

Przykład #1 mysqli::character_set_name() example

Styl obiektowy

<?php
/* Open a connection */
$mysqli = new mysqli("localhost""my_user""my_password""world");

/* check connection */
if (mysqli_connect_errno()) {
    
printf("Connect failed: %s\n"mysqli_connect_error());
    exit();
}

/* Print current character set */
$charset $mysqli->character_set_name();
printf ("Current character set is %s\n"$charset);

$mysqli->close();
?>

Styl proceduralny

<?php
/* Open a connection */
$link mysqli_connect("localhost""my_user""my_password""world");

/* check connection */
if (!$link) {
    
printf("Connect failed: %s\n"mysqli_connect_error());
    exit();
}

/* Print current character set */
$charset mysqli_character_set_name($link);
printf ("Current character set is %s\n",$charset);

/* close connection */
mysqli_close($link);
?>

Powyższe przykłady wyświetlą:

Current character set is latin1_swedish_ci

Zobacz też:

add a note add a note

User Contributed Notes

There are no user contributed notes for this page.
To Top