PHP host_info() / mysqli_get_host_info() İşlev
Örnek - Nesne Yönelimli stil
Sunucu ana bilgisayar adını ve bağlantı türünü döndürün:
<?php
$mysqli = new mysqli("localhost","my_user","my_password","my_db");
if ($mysqli -> connect_errno) {
echo "Failed to connect to MySQL: " .
$mysqli -> connect_error;
exit();
}
echo $mysqli -> host_info();
$mysqli -> close();
?>
En alttaki prosedürel stil örneğine bakın.
Tanım ve Kullanım
host_info() / mysqli_get_host_info() işlevi, MySQL sunucusunun ana bilgisayar adını ve bağlantı türünü döndürür.
Sözdizimi
Nesne yönelimli stil:
$mysqli -> host_info
Prosedür stili:
mysqli_get_host_info(connection)
Parametre Değerleri
Parameter | Description |
---|---|
connection | Required. Specifies the MySQL connection to use |
Teknik detaylar
Geri dönüş değeri: | MySQL sunucusu ana bilgisayar adını ve bağlantı türünü temsil eden bir dize döndürür |
---|---|
PHP Sürümü: | 5+ |
Örnek - Prosedürel stil
Sunucu ana bilgisayar adını ve bağlantı türünü döndürün:
<?php
$con = mysqli_connect("localhost","my_user","my_password","my_db");
if (mysqli_connect_errno()) {
echo "Failed to connect to MySQL: " . mysqli_connect_error();
exit();
}
echo mysqli_get_host_info($con);
mysqli_close($con);
?>
❮ PHP MySQLi Referansı