当前位置: 首页>>代码示例>>PHP>>正文


PHP mysqli_get_server_info函数代码示例

本文整理汇总了PHP中mysqli_get_server_info函数的典型用法代码示例。如果您正苦于以下问题:PHP mysqli_get_server_info函数的具体用法?PHP mysqli_get_server_info怎么用?PHP mysqli_get_server_info使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


在下文中一共展示了mysqli_get_server_info函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: connect

 /**
 +----------------------------------------------------------
 * 连接数据库方法
 +----------------------------------------------------------
 * @access public 
 +----------------------------------------------------------
 * @throws ThinkExecption
 +----------------------------------------------------------
 */
 public function connect($config = '', $linkNum = 0)
 {
     if (!isset($this->linkID[$linkNum])) {
         if (empty($config)) {
             $config = $this->config;
         }
         $this->linkID[$linkNum] = mysqli_connect($config['hostname'], $config['username'], $config['password'], $config['database'], $config['hostport']);
         if (!$this->linkID[$linkNum]) {
             throw_exception(mysqli_connect_error());
             return false;
         }
         if ($this->autoCommit) {
             mysqli_autocommit($this->linkID[$linkNum], true);
         } else {
             mysqli_autocommit($this->linkID[$linkNum], false);
         }
         $this->dbVersion = mysqli_get_server_info($this->linkID[$linkNum]);
         if ($this->dbVersion >= "4.1") {
             //使用UTF8存取数据库 需要mysql 4.1.0以上支持
             mysqli_query($this->linkID[$linkNum], "SET NAMES '" . C('DB_CHARSET') . "'");
         }
         // 标记连接成功
         $this->connected = true;
         //注销数据库安全信息
         if (1 != C('DB_DEPLOY_TYPE')) {
             unset($this->config);
         }
     }
     return $this->linkID[$linkNum];
 }
开发者ID:BGCX262,项目名称:zxzjob-svn-to-git,代码行数:39,代码来源:DbMysqli.class.php

示例2: connect

 function connect($iteration = 0, $rerunError = null)
 {
     if ($iteration > $this->reconnectIterations) {
         $e = new BrDBConnectionError($rerunError);
         br()->triggerSticky('db.connectionError', $e);
         throw $e;
     }
     $hostName = br($this->config, 'hostname');
     $dataBaseName = br($this->config, 'name');
     $userName = br($this->config, 'username');
     $password = br($this->config, 'password');
     $port = br($this->config, 'port');
     try {
         if ($this->__connection = @mysqli_connect($hostName, $userName, $password, $dataBaseName, $port)) {
             if (br($this->config, 'charset')) {
                 $this->runQuery('SET NAMES ?', $this->config['charset']);
             }
             $this->version = mysqli_get_server_info($this->__connection);
             $this->triggerSticky('after:connect');
             br()->triggerSticky('after:db.connect');
         } else {
             throw new Exception(mysqli_connect_errno() . ': ' . mysqli_connect_error());
         }
     } catch (Exception $e) {
         if (preg_match('/Unknown database/', $e->getMessage()) || preg_match('/Access denied/', $e->getMessage())) {
             br()->triggerSticky('db.connectionError', $e);
             throw new BrDBConnectionError($e->getMessage());
         } else {
             $this->__connection = null;
             usleep(250000);
             $this->connect($iteration + 1, $e->getMessage());
         }
     }
     return $this->__connection;
 }
开发者ID:jagermesh,项目名称:bright,代码行数:35,代码来源:BrMySQLiDBProvider.php

示例3: cleanOrphan

 /**
  * Clean orphan objects against linked objects
  *
  * @param  string $table_link   table of linked object for JOIN; deprecated, for backward compatibility
  * @param  string $field_link   field of linked object for JOIN; deprecated, for backward compatibility
  * @param  string $field_object field of current object for JOIN; deprecated, for backward compatibility
  * @return bool   true on success
  */
 public function cleanOrphan($table_link = '', $field_link = '', $field_object = '')
 {
     if (!empty($table_link)) {
         $this->handler->table_link = $table_link;
     }
     if (!empty($field_link)) {
         $this->handler->field_link = $field_link;
     }
     if (!empty($field_object)) {
         $this->handler->field_object = $field_object;
     }
     if (empty($this->handler->field_object) || empty($this->handler->table_link) || empty($this->handler->field_link)) {
         trigger_error("The link information is not set for '" . get_class($this->handler) . "' yet.", E_USER_WARNING);
         return null;
     }
     /**
      * for MySQL 4.1+
      */
     if (version_compare(mysqli_get_server_info($this->handler->db->conn), '4.1.0', 'ge')) {
         $sql = "DELETE FROM `{$this->handler->table}`" . " WHERE (`{$this->handler->field_object}` NOT IN ( SELECT DISTINCT `{$this->handler->field_link}` FROM `{$this->handler->table_link}`) )";
     } else {
         // for 4.0+
         $sql = "DELETE `{$this->handler->table}` FROM `{$this->handler->table}`" . " LEFT JOIN `{$this->handler->table_link}` AS aa ON `{$this->handler->table}`.`{$this->handler->field_object}` = aa.`{$this->handler->field_link}`" . " WHERE (aa.`{$this->handler->field_link}` IS NULL)";
     }
     if (!($result = $this->handler->db->queryF($sql))) {
         return false;
     }
     return true;
 }
开发者ID:geekwright,项目名称:XoopsCore25,代码行数:37,代码来源:sync.php

示例4: mysql_server_version

 /**
  * get MySQL server version
  *
  * @param null|XoopsDatabase|mysqli $conn
  *
  * @return string
  */
 public function mysql_server_version($conn = null)
 {
     if (null === $conn) {
         $conn = $this->db->conn;
     }
     return mysqli_get_server_info($conn);
 }
开发者ID:geekwright,项目名称:XoopsCore25,代码行数:14,代码来源:object.php

示例5: getAttribute

 public function getAttribute($attribute, &$source = null, $func = 'PDO::getAttribute', &$last_error = null)
 {
     if ($source == null) {
         $source =& $this->driver_options;
     }
     switch ($attribute) {
         case EhrlichAndreas_Pdo_Abstract::ATTR_AUTOCOMMIT:
             $result = mysqli_query($this->link, 'SELECT @@AUTOCOMMIT', MYSQLI_USE_RESULT);
             if (!$result) {
                 $this->set_driver_error(null, EhrlichAndreas_Pdo_Abstract::ERRMODE_EXCEPTION, $func);
             }
             $row = mysqli_fetch_row($result);
             mysqli_free_result($result);
             return intval($row[0]);
             break;
         case EhrlichAndreas_Pdo_Abstract::ATTR_CLIENT_VERSION:
             return mysqli_get_client_info();
             break;
         case EhrlichAndreas_Pdo_Abstract::ATTR_CONNECTION_STATUS:
             return mysqli_get_host_info($this->link);
             break;
         case EhrlichAndreas_Pdo_Abstract::ATTR_SERVER_INFO:
             return mysqli_stat($this->link);
             break;
         case EhrlichAndreas_Pdo_Abstract::ATTR_SERVER_VERSION:
             return mysqli_get_server_info($this->link);
             break;
         default:
             return parent::getAttribute($attribute, $source, $func, $last_error);
             break;
     }
 }
开发者ID:ehrlichandreas,项目名称:ehrlichandreas1-pdo,代码行数:32,代码来源:Mysqli.php

示例6: dump_properties

function dump_properties($mysqli)
{
    printf("\nClass variables:\n");
    $variables = array_keys(get_class_vars(get_class($mysqli)));
    sort($variables);
    foreach ($variables as $k => $var) {
        printf("%s = '%s'\n", $var, var_export(@$mysqli->{$var}, true));
    }
    printf("\nObject variables:\n");
    $variables = array_keys(get_object_vars($mysqli));
    foreach ($variables as $k => $var) {
        printf("%s = '%s'\n", $var, var_export(@$mysqli->{$var}, true));
    }
    printf("\nMagic, magic properties:\n");
    assert(@mysqli_affected_rows($mysqli) === @$mysqli->affected_rows);
    printf("mysqli->affected_rows = '%s'/%s ('%s'/%s)\n", @$mysqli->affected_rows, gettype(@$mysqli->affected_rows), @mysqli_affected_rows($mysqli), gettype(@mysqli_affected_rows($mysqli)));
    assert(@mysqli_get_client_info() === @$mysqli->client_info);
    printf("mysqli->client_info = '%s'/%s ('%s'/%s)\n", @$mysqli->client_info, gettype(@$mysqli->client_info), @mysqli_get_client_info(), gettype(@mysqli_get_client_info()));
    assert(@mysqli_get_client_version() === @$mysqli->client_version);
    printf("mysqli->client_version =  '%s'/%s ('%s'/%s)\n", @$mysqli->client_version, gettype(@$mysqli->client_version), @mysqli_get_client_version(), gettype(@mysqli_get_client_version()));
    assert(@mysqli_errno($mysqli) === @$mysqli->errno);
    printf("mysqli->errno = '%s'/%s ('%s'/%s)\n", @$mysqli->errno, gettype(@$mysqli->errno), @mysqli_errno($mysqli), gettype(@mysqli_errno($mysqli)));
    assert(@mysqli_error($mysqli) === @$mysqli->error);
    printf("mysqli->error = '%s'/%s ('%s'/%s)\n", @$mysqli->error, gettype(@$mysqli->error), @mysqli_error($mysqli), gettype(@mysqli_error($mysqli)));
    assert(@mysqli_field_count($mysqli) === @$mysqli->field_count);
    printf("mysqli->field_count = '%s'/%s ('%s'/%s)\n", @$mysqli->field_count, gettype(@$mysqli->field_count), @mysqli_field_count($mysqli), gettype(@mysqli_field_count($mysqli)));
    assert(@mysqli_insert_id($mysqli) === @$mysqli->insert_id);
    printf("mysqli->insert_id = '%s'/%s ('%s'/%s)\n", @$mysqli->insert_id, gettype(@$mysqli->insert_id), @mysqli_insert_id($mysqli), gettype(@mysqli_insert_id($mysqli)));
    assert(@mysqli_sqlstate($mysqli) === @$mysqli->sqlstate);
    printf("mysqli->sqlstate = '%s'/%s ('%s'/%s)\n", @$mysqli->sqlstate, gettype(@$mysqli->sqlstate), @mysqli_sqlstate($mysqli), gettype(@mysqli_sqlstate($mysqli)));
    assert(@mysqli_get_host_info($mysqli) === @$mysqli->host_info);
    printf("mysqli->host_info = '%s'/%s ('%s'/%s)\n", @$mysqli->host_info, gettype(@$mysqli->host_info), @mysqli_get_host_info($mysqli), gettype(@mysqli_get_host_info($mysqli)));
    /* note that the data types are different */
    assert(@mysqli_info($mysqli) == @$mysqli->info);
    printf("mysqli->info = '%s'/%s ('%s'/%s)\n", @$mysqli->info, gettype(@$mysqli->info), @mysqli_info($mysqli), gettype(@mysqli_info($mysqli)));
    assert(@mysqli_thread_id($mysqli) > @$mysqli->thread_id);
    assert(gettype(@$mysqli->thread_id) == gettype(@mysqli_thread_id($mysqli)));
    printf("mysqli->thread_id = '%s'/%s ('%s'/%s)\n", @$mysqli->thread_id, gettype(@$mysqli->thread_id), @mysqli_thread_id($mysqli), gettype(@mysqli_thread_id($mysqli)));
    assert(@mysqli_get_proto_info($mysqli) === @$mysqli->protocol_version);
    printf("mysqli->protocol_version = '%s'/%s ('%s'/%s)\n", @$mysqli->protocol_version, gettype(@$mysqli->protocol_version), @mysqli_get_proto_info($mysqli), gettype(@mysqli_get_proto_info($mysqli)));
    assert(@mysqli_get_server_info($mysqli) === @$mysqli->server_info);
    printf("mysqli->server_info = '%s'/%s ('%s'/%s)\n", @$mysqli->server_info, gettype(@$mysqli->server_info), @mysqli_get_server_info($mysqli), gettype(@mysqli_get_server_info($mysqli)));
    assert(@mysqli_get_server_version($mysqli) === @$mysqli->server_version);
    printf("mysqli->server_version = '%s'/%s ('%s'/%s)\n", @$mysqli->server_version, gettype(@$mysqli->server_version), @mysqli_get_server_version($mysqli), gettype(@mysqli_get_server_version($mysqli)));
    assert(@mysqli_warning_count($mysqli) === @$mysqli->warning_count);
    printf("mysqli->warning_count = '%s'/%s ('%s'/%s)\n", @$mysqli->warning_count, gettype(@$mysqli->warning_count), @mysqli_warning_count($mysqli), gettype(@mysqli_warning_count($mysqli)));
    printf("\nAccess to undefined properties:\n");
    printf("mysqli->unknown = '%s'\n", @$mysqli->unknown);
    @($mysqli->unknown = 13);
    printf("setting mysqli->unknown, @mysqli_unknown = '%s'\n", @$mysqli->unknown);
    $unknown = 'friday';
    @($mysqli->unknown = $unknown);
    printf("setting mysqli->unknown, @mysqli_unknown = '%s'\n", @$mysqli->unknown);
    printf("\nAccess hidden properties for MYSLQI_STATUS_INITIALIZED (TODO documentation):\n");
    assert(@mysqli_connect_error() === @$mysqli->connect_error);
    printf("mysqli->connect_error = '%s'/%s ('%s'/%s)\n", @$mysqli->connect_error, gettype(@$mysqli->connect_error), @mysqli_connect_error(), gettype(@mysqli_connect_error()));
    assert(@mysqli_connect_errno() === @$mysqli->connect_errno);
    printf("mysqli->connect_errno = '%s'/%s ('%s'/%s)\n", @$mysqli->connect_errno, gettype(@$mysqli->connect_errno), @mysqli_connect_errno(), gettype(@mysqli_connect_errno()));
}
开发者ID:alphaxxl,项目名称:hhvm,代码行数:59,代码来源:mysqli_class_mysqli_properties_no_conn.php

示例7: getList

 public function getList()
 {
     if (!$this->_list) {
         $server_software = !empty($_SERVER['SERVER_SOFTWARE']) ? $_SERVER['SERVER_SOFTWARE'] : JText::_('n/a');
         $rows = array(array('setting' => JText::_('PHP Built On'), 'value' => php_uname()), array('setting' => JText::_('Database Version'), 'value' => mysqli_get_server_info($this->getService('koowa:database.adapter.mysqli')->getConnection())), array('setting' => JText::_('Database Collation'), 'value' => $this->getService('com://admin/extensions.database.table.plugins')->getSchema()->collation), array('setting' => JText::_('PHP Version'), 'value' => phpversion()), array('setting' => JText::_('Web Server'), 'value' => $server_software), array('setting' => JText::_('WebServer to PHP Interface'), 'value' => php_sapi_name()), array('setting' => JText::_('Nooku Server Version'), 'value' => Koowa::getVersion()), array('setting' => JText::_('User Agent'), 'value' => $_SERVER['HTTP_USER_AGENT'], ENT_QUOTES));
         $this->_list = $this->getService('com://admin/info.database.rowset.system')->addData($rows, false);
     }
     return $this->_list;
 }
开发者ID:JSWebdesign,项目名称:intranet-platform,代码行数:9,代码来源:system.php

示例8: show_info

 private function show_info()
 {
     $total_space = round(@disk_total_space(".") / (1024 * 1024));
     $free_space = round(@disk_free_space(".") / (1024 * 1024));
     $already_used = round($total_space - $free_space);
     $already_used_percent = round(($total_space - $free_space) / $total_space * 100);
     $server_info = array('os' => PHP_OS, 'server_software' => $_SERVER["SERVER_SOFTWARE"], 'php' => php_sapi_name(), 'mysqli' => mysqli_get_server_info($this->model->getDb()), 'canon_version' => 1.0 . "&nbsp;&nbsp;&nbsp; [<a href='http://phpgoto.com' target='_blank'>访问官网</a>]", 'upload' => ini_get('upload_max_filesize'), 'total_space' => $total_space, 'free_space' => $free_space, 'already_used' => $already_used, 'already_used_percent' => $already_used_percent);
     //dump($server_info);
     return $server_info;
 }
开发者ID:skywingfs,项目名称:kmhotel,代码行数:10,代码来源:admin_controller.php

示例9: _db_set_charset

 function _db_set_charset($charset, $collation)
 {
     if (!isset($this->use_set_names)) {
         $this->use_set_names = version_compare(mysqli_get_server_info($this->conn_id), '5.0.7', '>=') ? FALSE : TRUE;
     }
     if ($this->use_set_names === TRUE) {
         return @mysqli_query($this->conn_id, "SET NAMES '" . $this->escape_str($charset) . "' COLLATE '" . $this->escape_str($collation) . "'");
     } else {
         return @mysqli_set_charset($this->conn_id, $charset);
     }
 }
开发者ID:pepegarcia,项目名称:publicidadoficialdemo-1,代码行数:11,代码来源:mysqli_driver.php

示例10: isServerSupportingSavePoints

 protected final function isServerSupportingSavePoints()
 {
     if ($this->supportsSavePoints === null) {
         $version = mysqli_get_server_info($this->link);
         if (version_compare($version, '5.0.3') >= 0) {
             $this->supportsSavePoints = true;
         } else {
             $this->supportsSavePoints = false;
         }
     }
     return $this->supportsSavePoints;
 }
开发者ID:xiaoguizhidao,项目名称:extensiongsd,代码行数:12,代码来源:Driver.php

示例11: versionMysql

 function versionMysql()
 {
     $test = is_null($___mysqli_res = mysqli_get_server_info($GLOBALS["mysqli"])) ? false : $___mysqli_res;
     // On regarde si c'est une version 4 ou 5
     $version = mb_substr($test, 0, 1);
     if ($version == 4 or $version == 5) {
         $retour = '<span style="color: green;">' . (is_null($___mysqli_res = mysqli_get_server_info($GLOBALS["mysqli"])) ? false : $___mysqli_res) . '</span>';
     } else {
         $retour = '<span style="color: red;">' . (is_null($___mysqli_res = mysqli_get_server_info($GLOBALS["mysqli"])) ? false : $___mysqli_res) . '(version ancienne !)</span>';
     }
     return $retour;
 }
开发者ID:rhertzog,项目名称:lcs,代码行数:12,代码来源:serveur_infos.class.php

示例12: connect

 private function connect()
 {
     $this->id = mysqli_connect($this->config['location'], $this->config['user'], $this->config['pass'], $this->config['name']);
     if (!$this->id) {
         if ($this->config['show_error'] == 1) {
             $this->display_error(mysqli_connect_error(), '1', 'connect');
         } else {
             return false;
         }
     }
     $this->mysql_version = mysqli_get_server_info($this->id);
     mysqli_query($this->id, "SET NAMES '" . $this->collate . "'");
 }
开发者ID:Japing,项目名称:pcp-cs,代码行数:13,代码来源:mysqli.class.php

示例13: serverVers

 function serverVers()
 {
     // cache for faster execution:
     if (is_array($this->_drvSrvVersArr)) {
         return $this->_drvSrvVersArr;
     }
     $orig = @mysqli_get_server_info($this->_conn);
     $vstr = $this->_findVers($orig);
     $vint = @mysqli_get_server_version($this->_conn);
     $vArr = array('orig' => $orig, 'vstr' => $vstr, 'vint' => $vint);
     $this->_drvSrvVersArr = $vArr;
     return $vArr;
 }
开发者ID:rkania,项目名称:GS3,代码行数:13,代码来源:mysqli.php

示例14: mod_getMysqlVersion

/**
 * get MySQL server version
 *
 * In some cases mysql_get_client_info is required instead
 *
 * @param null $conn
 *
 * @return     string
 */
function mod_getMysqlVersion($conn = null)
{
    global $xoopsDB;
    static $mysql_version;
    if (isset($mysql_version)) {
        return $mysql_version;
    }
    if (null === $conn) {
        $conn = $xoopsDB->conn;
    }
    $mysql_version = mysqli_get_server_info($conn);
    return $mysql_version;
}
开发者ID:geekwright,项目名称:XoopsCore25,代码行数:22,代码来源:functions.php

示例15: vbseodb_connect

 function vbseodb_connect($server, $user, $password, $usepconnect, $tableprefix = '', $database, $port)
 {
     global $vbulletin, $DB_site, $config;
     if (!defined('TABLE_PREFIX')) {
         define('TABLE_PREFIX', $tableprefix);
     }
     if (0 == $this->link_id) {
         $this->mysqli = $config['Database']['dbtype'] == 'mysqli';
         if (is_object($vbulletin) && isset($vbulletin->db) && (isset($vbulletin->db->connection_slave) && ($dlnk = $vbulletin->db->connection_slave) || isset($vbulletin->db->connection_master) && ($dlnk = $vbulletin->db->connection_master)) && (@is_object($dlnk) ? @mysqli_get_server_info($dlnk) : @mysql_get_server_info($dlnk))) {
             $this->link_id = $dlnk;
         } else {
             if (isset($DB_site) && $DB_site->link_id) {
                 $this->link_id = $DB_site->link_id;
             } else {
                 $this->own_link = 1;
                 if ($usepconnect == 1) {
                     $this->link_id = @mysql_pconnect($server . ($port && $port != 3306 ? ':' . $port : ''), $user, $password);
                 } else {
                     if ($this->mysqli) {
                         $this->link_id = mysqli_init();
                         @mysqli_real_connect($this->link_id, $server, $user, $password, $database, $port);
                     } else {
                         $this->link_id = @mysql_connect($server . ($port && $port != 3306 ? ':' . $port : ''), $user, $password);
                     }
                 }
             }
         }
         if (!$this->link_id) {
             return false;
         }
         $this->mysqli = @is_object($this->link_id);
         if ($this->mysqli) {
             $this->funcs = array('get_server_info' => 'mysqli_get_server_info', 'select_db' => 'mysqli_select_db', 'query' => 'mysqli_query', 'affected_rows' => 'mysqli_affected_rows', 'num_rows' => 'mysqli_num_rows', 'free_result' => 'mysqli_free_result', 'fetch_array' => 'mysqli_fetch_array', 'fetch_assoc' => 'mysqli_fetch_assoc', 'close' => 'mysqli_close');
         } else {
             $this->funcs = array('get_server_info' => 'mysql_get_server_info', 'select_db' => 'mysql_select_db', 'query' => 'mysql_query', 'affected_rows' => 'mysql_affected_rows', 'num_rows' => 'mysql_num_rows', 'free_result' => 'mysql_free_result', 'fetch_array' => 'mysql_fetch_array', 'fetch_assoc' => 'mysql_fetch_assoc', 'close' => 'mysql_close');
             $this->vbseodb_select_db($database);
         }
         if (isset($config['Mysqli']['charset']) && ($charset = $config['Mysqli']['charset'])) {
             if ($this->mysqli && function_exists('mysqli_set_charset')) {
                 mysqli_set_charset($this->link_id, $charset);
             } else {
                 $this->vbseodb_query("SET NAMES {$charset}");
             }
         }
         $this->mysql_version = function_exists($this->funcs['get_server_info']) ? $this->funcs['get_server_info']($this->link_id) : '';
         return true;
     }
 }
开发者ID:holandacz,项目名称:nb4,代码行数:48,代码来源:functions_vbseo_db.php


注:本文中的mysqli_get_server_info函数示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。