PHP mysql_get_host_info 取得 MySQL 主机信息

时间:2016-07-06
php mysql_get_host_info 取得 MySQL 主机信息,本文章向大家介绍mysql_get_host_info函数的使用方法和实例,需要的朋友可以参考一下。

mysql_get_host_info — 取得 MySQL 主机信息

mysql_get_host_info介绍

string mysql_get_host_info ([ resource $link_identifier ] )

mysql_get_host_info() 返回一个字符串说明了连接 link_identifier 所使用的连接方式,包括服务器的主机名。如果省略 link_identifier,则使用上一个打开的连接。

mysql_get_host_info() 实例

<?php
    mysql_connect("localhost", "mysql_user", "mysql_password") or
        die("Could not connect: " . mysql_error());
    printf ("MySQL host info: %s ", mysql_get_host_info());
?>

以上例子将产生如下输出:

MySQL host info: Localhost via UNIX socket