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


PHP mysqli_character_set_name函数代码示例

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


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

示例1: db

/**
 * 创建数据库连接
 * @param string $k 配置文件key
 * @return resource
 */
function db($k = 'default')
{
    $conf = conf('db', $k);
    if (!$conf) {
        trigger_error('Can\'t find $GLOBALS[\'db\'][\'' . $k . '\'] - in database.conf.php');
    }
    $db_key = md5("{$conf['hostname']}-{$conf['username']}-{$conf['password']}-{$conf['database']}");
    if (!isset($GLOBALS[$db_key])) {
        $server = $conf['hostname'] . ':' . $conf['port'];
        $link = mysql_connect($server, $conf['username'], $conf['password'], TRUE);
        if (!$link) {
            trigger_error('Connect database be fail, Pealse inspect yours database setting!');
        }
        if (!mysql_select_db($conf['database'], $link)) {
            trigger_error("Can't select database - {$conf['database']}, Pealse inspect yours database setting");
        }
        if (function_exists('mysql_set_charset')) {
            $is_set_charset = mysql_set_charset($conf['char_set']);
        } else {
            if (function_exists('mysqli_character_set_name')) {
                $is_set_charset = mysqli_character_set_name($conf['char_set']);
            } else {
                $is_set_charset = mysql_query("SET names '{$conf['char_set']}'");
            }
        }
        if ($is_set_charset != TRUE) {
            exit('charset error!');
        }
        //mysql_query( "SET names = '{$conf['char_set']}'" );
        mysql_query("SET CHARACTER SET '{$conf['char_set']}'");
        $GLOBALS[$db_key] = $link;
    }
    return $GLOBALS[$db_key];
}
开发者ID:boxcore,项目名称:xspider,代码行数:39,代码来源:db.fn.php

示例2: CreateLink

 private final function CreateLink()
 {
     $this->link = mysqli_connect('localhost', 'panel', '1q2w3e4r', $this->dbname) or $this->ErrorMsg(mysqli_connect_error());
     if (mysqli_character_set_name($this->link) != 'utf8') {
         if (!mysqli_set_charset($this->link, 'utf8')) {
             $this->ErrorMsg(mysqli_error($this->link));
         }
     }
 }
开发者ID:nulled,项目名称:anypanel,代码行数:9,代码来源:MySQLi_Access.core.class.php

示例3: obtenerTodasLasFallas

function obtenerTodasLasFallas()
{
    $fallas = array();
    $sql = "SELECT id, nombre_falla FROM operaciones_fallas ORDER BY nombre_falla ASC";
    $link = Conectarse();
    // obtenemos todos los países
    $result = mysqli_query($link, $sql);
    // creamos objetos de la clase país y los agregamos al arreglo
    while ($row = $result->fetch_assoc()) {
        $row['nombre_falla'] = mb_convert_encoding($row['nombre_falla'], 'UTF-8', mysqli_character_set_name($link));
        $falla = new falla($row['id'], $row['nombre_falla']);
        array_push($fallas, $falla);
    }
    // devolvemos el arreglo
    return $fallas;
}
开发者ID:jpsepa,项目名称:SINGO,代码行数:16,代码来源:fallas.php

示例4: obtenerTodosLosEquipos

function obtenerTodosLosEquipos()
{
    $equipos = array();
    $sql = "SELECT id, nombre FROM operaciones_equipos ORDER BY nombre ASC";
    $link = Conectarse();
    // obtenemos todos los países
    $result = mysqli_query($link, $sql);
    // creamos objetos de la clase país y los agregamos al arreglo
    while ($row = $result->fetch_assoc()) {
        $row['nombre'] = mb_convert_encoding($row['nombre'], 'UTF-8', mysqli_character_set_name($link));
        $equipo = new equipo($row['id'], $row['nombre']);
        array_push($equipos, $equipo);
    }
    // devolvemos el arreglo
    return $equipos;
}
开发者ID:jpsepa,项目名称:SINGO,代码行数:16,代码来源:equipos.php

示例5: obtenerCursos

function obtenerCursos()
{
    $estatus = "ABIERTO";
    $cursos = array();
    $sql = "SELECT id, nombre \r\n                FROM cursos WHERE estatus ='ABIERTO'";
    $db = obtenerConexion();
    // obtenemos todos las sedes
    $result = ejecutarQuery($db, $sql);
    // creamos objetos de la clase sede y los agregamos al arreglo
    while ($row = $result->fetch_assoc()) {
        $row['nombre'] = mb_convert_encoding($row['nombre'], 'UTF-8', mysqli_character_set_name($db));
        $nombre = new nombre($row['nombre'], $row['nombre']);
        array_push($cursos, $nombre);
    }
    cerrarConexion($db, $result);
    // devolvemos el arreglo
    return $cursos;
}
开发者ID:aniragus0,项目名称:plataforma,代码行数:18,代码来源:combos.php

示例6: listar_Todo

function listar_Todo()
{
    $servername = "localhost";
    $username = "eusa15";
    $password = "eusa15";
    $dbname = "eusa15_bdphp";
    $conn = mysqli_connect($servername, $username, $password, $dbname);
    // Check connection
    if (!$conn) {
        echo "Error!";
    }
    if (!mysqli_set_charset($conn, "utf8")) {
        mysqli_error($conn);
    } else {
        mysqli_character_set_name($conn);
    }
    $sql = "SELECT centros.nombre as nombre, centros.id as idC, centros.direccion as dir, centros.localidad as loc, centros.telefono as tel FROM centros";
    $result = $conn->query($sql);
    if ($result->num_rows > 0) {
        while ($row = $result->fetch_assoc()) {
            echo "<h2>" . $row["nombre"] . "</h2>" . "<p>Localidad: " . $row["loc"] . "</p>" . "<p>Direccion: " . $row["dir"] . "</p>" . "<p>Telefono: " . $row["tel"] . "</p><br/>";
            $n = $row["idC"];
            $sql2 = "SELECT MEDICOS.NOMBRE as nombre, MEDICOS.APELLIDOS as apellidos, especialidades.nombre as especialidad, HORARIOS.DIA as dias, HORARIOS.HORARIO as horario from MEDICOS, HORARIOS, especialidades where MEDICOS.ID_ESPECIALIDAD = especialidades.id and MEDICOS.ID_MEDICO=HORARIOS.ID_MEDICO and HORARIOS.ID_CENTRO=" . $n . "";
            $result2 = $conn->query($sql2);
            if ($result2->num_rows > 0) {
                echo "<table><thead><tr><th>Apellidos</th><th>Nombre</th><th>Especialidad</th><th>Dias</th><th>Horario</th></tr></thead><tbody>";
                $bandera = true;
                while ($row2 = $result2->fetch_assoc()) {
                    if ($bandera) {
                        echo "<tr class='alt'>" . "<td>" . $row2["apellidos"] . "</td>" . "<td>" . $row2["nombre"] . "</td>" . "<td>" . $row2["especialidad"] . "</td>" . "<td>" . $row2["dias"] . "</td>" . "<td>" . $row2["horario"] . "</td>" . "</tr>";
                    } else {
                        echo "<tr>" . "<td>" . $row2["apellidos"] . "</td>" . "<td>" . $row2["nombre"] . "</td>" . "<td>" . $row2["especialidad"] . "</td>" . "<td>" . $row2["dias"] . "</td>" . "<td>" . $row2["horario"] . "</td>" . "</tr>";
                    }
                    $bandera = !$bandera;
                }
                echo "</tbody></table><br/><br/>";
            }
        }
    } else {
        echo "0 results";
    }
    $conn->close();
}
开发者ID:FranLedro,项目名称:ProyectoPHP2016,代码行数:43,代码来源:listarMedicos.php

示例7: __tcSqlLogEnd

function __tcSqlLogEnd($result, $cachedResult = 0)
{
    global $__tcSqlLog, $__tcSqlQueryBeginTime, $__tcSqlLogCount, $__tcPageStartTime;
    static $client_encoding = '';
    $tcSqlQueryEndTime = explode(' ', microtime());
    $elapsed = $tcSqlQueryEndTime[1] - $__tcSqlQueryBeginTime[1] + ($tcSqlQueryEndTime[0] - $__tcSqlQueryBeginTime[0]);
    if (!$client_encoding) {
        $client_encoding = str_replace('_', '-', mysqli_character_set_name(POD::$db));
    }
    if ($client_encoding != 'utf8' && function_exists('iconv')) {
        $__tcSqlLog[$__tcSqlLogCount]['error'] = iconv($client_encoding, 'utf-8', mysqli_error(POD::$db));
    } else {
        $__tcSqlLog[$__tcSqlLogCount]['error'] = mysqli_error(POD::$db);
    }
    $__tcSqlLog[$__tcSqlLogCount]['errno'] = mysqli_errno(POD::$db);
    if ($cachedResult == 0) {
        $__tcSqlLog[$__tcSqlLogCount]['elapsed'] = ceil($elapsed * 10000) / 10;
    } else {
        $__tcSqlLog[$__tcSqlLogCount]['elapsed'] = 0;
    }
    $__tcSqlLog[$__tcSqlLogCount]['elapsed'] = sprintf("%4.1f", $__tcSqlLog[$__tcSqlLogCount]['elapsed']);
    $__tcSqlLog[$__tcSqlLogCount]['cached'] = $cachedResult;
    $__tcSqlLog[$__tcSqlLogCount]['rows'] = 0;
    $__tcSqlLog[$__tcSqlLogCount]['endtime'] = $tcSqlQueryEndTime[1] - $__tcPageStartTime[1] + ($tcSqlQueryEndTime[0] - $__tcPageStartTime[0]);
    $__tcSqlLog[$__tcSqlLogCount]['endtime'] = sprintf("%4.1f", ceil($__tcSqlLog[$__tcSqlLogCount]['endtime'] * 10000) / 10);
    if (!$cachedResult && mysqli_errno(POD::$db) == 0) {
        switch (strtolower(substr($__tcSqlLog[$__tcSqlLogCount]['sql'], 0, 6))) {
            case 'select':
                $__tcSqlLog[$__tcSqlLogCount]['rows'] = mysqli_num_rows($result);
                break;
            case 'insert':
            case 'delete':
            case 'update':
                $__tcSqlLog[$__tcSqlLogCount]['rows'] = mysqli_affected_rows(POD::$db);
                break;
        }
    }
    $__tcSqlLogCount++;
    $__tcSqlQueryBeginTime = 0;
}
开发者ID:webhacking,项目名称:Textcube,代码行数:40,代码来源:Debug.php

示例8: isConnectionUTF8

 /**
  * Is the connection character set equal to utf8?
  *
  * @return bool
  */
 public function isConnectionUTF8()
 {
     $charset = mysqli_character_set_name($this->_connection);
     return $charset === 'utf8';
 }
开发者ID:ntulip,项目名称:piwik,代码行数:10,代码来源:Mysqli.php

示例9: mysql_client_encoding

 function mysql_client_encoding(&$c = null)
 {
     if (($c = mysql_global_resource($c, 1 - func_num_args())) == null) {
         return;
     }
     return mysqli_character_set_name($c);
 }
开发者ID:OOPS-ORG-PHP,项目名称:mysql-extension-wrapper,代码行数:7,代码来源:mysql-wrapper.php

示例10: mysql_client_encoding

 function mysql_client_encoding(\mysqli $link = null)
 {
     return mysqli_character_set_name(\Dshafik\MySQL::getConnection($link));
 }
开发者ID:gsomoza,项目名称:php7-mysql-shim,代码行数:4,代码来源:mysql.php

示例11: getDbInfo

 public function getDbInfo()
 {
     $charsets = $this->getCharsetInfo();
     $charset_str = array();
     foreach ($charsets as $name => $value) {
         $charset_str[] = "{$name} = {$value}";
     }
     return array("MySQLi Version" => @mysqli_get_client_info(), "MySQLi Host Info" => @mysqli_get_host_info($this->database), "MySQLi Server Info" => @mysqli_get_server_info($this->database), "MySQLi Client Encoding" => @mysqli_character_set_name($this->database), "MySQL Character Set Settings" => join(", ", $charset_str));
 }
开发者ID:jglaine,项目名称:sugar761-ent,代码行数:9,代码来源:MysqliManager.php

示例12: die

 * @platform        WebsiteBaker 2.8.x
 * @version         0.4.1
 * @lastmodified    August 23, 2016
 *
 */
// Must include code to stop this file being access directly
if (defined('WB_PATH') == false) {
    die("Cannot access this file directly");
}
if (is_object($database->DbHandle)) {
    $title = "MySQLi Info";
    $server_info = mysqli_get_server_info($database->DbHandle);
    $host_info = mysqli_get_host_info($database->DbHandle);
    $proto_info = mysqli_get_proto_info($database->DbHandle);
    $client_info = mysqli_get_client_info($database->DbHandle);
    $client_encoding = mysqli_character_set_name($database->DbHandle);
    $status = explode('  ', mysqli_stat($database->DbHandle));
} else {
    $title = "MySQL Info";
    $server_info = mysql_get_server_info();
    $host_info = mysql_get_host_info();
    $proto_info = mysql_get_proto_info();
    $client_info = mysql_get_client_info();
    $client_encoding = mysql_client_encoding();
    $status = explode('  ', mysql_stat());
}
$strictMode = $database->get_one('SELECT @@sql_mode');
$strict_info = (strpos($strictMode, 'STRICT_TRANS_TABLES') !== false or strpos($strictMode, 'STRICT_ALL_TABLES') !== false) ? "MySQL strict mode active" : "MySQL strict mode not active\n";
?>
<table cellpadding="3" border="0">
	<tbody>
开发者ID:WebsiteBaker-modules,项目名称:sysinfo,代码行数:31,代码来源:mysqlinfo.php

示例13: executemysql

function executemysql($getinfo, $getdumps, $getschema)
{
    //BEGIN GET DB INFO
    global $getDumpsFrom;
    global $curdatetime;
    global $sugar_config;
    global $progress_bar_percent;
    global $sod_guid;
    global $db;
    if ($db->dbType != "mysql") {
        if ($getinfo) {
            sodUpdateProgressBar(MYSQL_INFO_WEIGHT);
        }
        if ($getschema) {
            sodUpdateProgressBar(MYSQL_SCHEMA_WEIGHT);
        }
        if ($getdumps) {
            sodUpdateProgressBar(MYSQL_DUMPS_WEIGHT);
        }
        return;
    }
    $mysqlInfoDir = create_cache_directory("diagnostic/" . $sod_guid . "/diagnostic" . $curdatetime . "/MySQL/");
    //create directory for table definitions
    if ($getschema) {
        $tablesSchemaDir = create_cache_directory("diagnostic/" . $sod_guid . "/diagnostic" . $curdatetime . "/MySQL/TableSchema/");
    }
    //BEGIN GET MYSQL INFO
    //make sure they checked the box to get basic info
    if ($getinfo) {
        ob_start();
        echo "MySQL Version: " . (function_exists('mysqli_get_client_info') ? @mysqli_get_client_info() : @mysql_get_client_info()) . "<BR>";
        echo "MySQL Host Info: " . (function_exists('mysqli_get_host_info') ? @mysqli_get_host_info($db->getDatabase()) : @mysql_get_host_info()) . "<BR>";
        echo "MySQL Server Info: " . (function_exists('mysqli_get_client_info') ? @mysqli_get_client_info() : @mysql_get_client_info()) . "<BR>";
        echo "MySQL Client Encoding: " . (function_exists('mysqli_character_set_name') ? @mysqli_character_set_name($db->getDatabase()) : @mysql_client_encoding()) . "<BR>";
        /* Uncomment to get current processes as well
           echo "<BR>MySQL Processes<BR>";
           $res = $db->query('SHOW PROCESSLIST');
           echo "<table border=\"1\"><tr><th>Id</th><th>Host</th><th>db</th><th>Command</th><th>Time</th></tr>";
           if($db->getRowCount($res) > 0)
           {
             while($row = $db->fetchByAssoc($res))
             {
               printf("<tr><td>%s</td><td>%s</td><td>%s</td><td>%s</td><td>%s</td></tr>",
                      $row['Id'], $row['Host'], $row['db'], $row['Command'], $row['Time']
                      );
             }
             echo "</table><br>";
           }
           else
           {
             echo "</table>";
             echo "No processes running<br>";
           }
           */
        echo "<BR>MySQL Character Set Settings<BR>";
        $res = $db->query("show variables like 'character\\_set\\_%'");
        echo "<table border=\"1\"><tr><th>Variable Name</th><th>Value</th></tr>";
        while ($row = $db->fetchByAssoc($res)) {
            printf("<tr><td>%s</td><td>%s</td></tr>", $row['Variable_name'], $row['Value']);
        }
        echo "</table>";
        $content = ob_get_contents();
        ob_clean();
        $handle = sugar_fopen($mysqlInfoDir . "MySQL-General-info.html", "w");
        if (fwrite($handle, $content) === FALSE) {
            echo "Cannot write to file " . $mysqlInfoDir . "_MySQL-General-info.html<br>";
        }
        fclose($handle);
        //BEGIN UPDATING PROGRESS BAR
        sodUpdateProgressBar(MYSQL_INFO_WEIGHT);
        //END UPDATING PROGRESS BAR
    }
    //END GET MYSQL INFO
    if ($getschema) {
        //BEGIN GET ALL TABLES SCHEMAS
        $all_tables = $db->getTablesArray();
        global $theme_path;
        ob_start();
        echo "<style>";
        echo file_get_contents($theme_path . "style.css");
        echo "</style>";
        foreach ($all_tables as $tablename) {
            //setting up table header for each file
            echo "<table border=\"0\" cellpadding=\"0\" class=\"tabDetailView\">";
            echo "<tr>MySQL " . $tablename . " Definitions:</tr>" . "<tr><td class=\"tabDetailViewDL\"><b>Field</b></td>" . "<td class=\"tabDetailViewDL\">Type</td>" . "<td class=\"tabDetailViewDL\">Null</td>" . "<td class=\"tabDetailViewDL\">Key</td>" . "<td class=\"tabDetailViewDL\">Default</td>" . "<td class=\"tabDetailViewDL\">Extra</td></tr>";
            $describe = $db->query("describe " . $tablename);
            while ($inner_row = $db->fetchByAssoc($describe)) {
                $inner_row = array_values($inner_row);
                echo "<tr><td class=\"tabDetailViewDF\"><b>" . $inner_row[0] . "</b></td>";
                echo "<td class=\"tabDetailViewDF\">" . $inner_row[1] . "</td>";
                echo "<td class=\"tabDetailViewDF\">" . $inner_row[2] . "</td>";
                echo "<td class=\"tabDetailViewDF\">" . $inner_row[3] . "</td>";
                echo "<td class=\"tabDetailViewDF\">" . $inner_row[4] . "</td>";
                echo "<td class=\"tabDetailViewDF\">" . $inner_row[5] . "</td></tr>";
            }
            echo "</table>";
            echo "<BR><BR>";
        }
        $content = ob_get_contents();
        ob_clean();
//.........这里部分代码省略.........
开发者ID:sysraj86,项目名称:carnivalcrm,代码行数:101,代码来源:DiagnosticRun.php

示例14: isset

$_POST['postguid'] = isset($_POST['postguid']) && $_POST['postguid'] == 1 ? 1 : 0;
$_POST['fullsearch'] = isset($_POST['fullsearch']) && $_POST['fullsearch'] == 1 ? 1 : 0;
$_POST['path_old'] = isset($_POST['path_old']) ? trim($_POST['path_old']) : null;
$_POST['path_new'] = isset($_POST['path_new']) ? trim($_POST['path_new']) : null;
$_POST['siteurl'] = isset($_POST['siteurl']) ? rtrim(trim($_POST['siteurl']), '/') : null;
$_POST['tables'] = isset($_POST['tables']) && is_array($_POST['tables']) ? array_map('stripcslashes', $_POST['tables']) : array();
$_POST['url_old'] = isset($_POST['url_old']) ? trim($_POST['url_old']) : null;
$_POST['url_new'] = isset($_POST['url_new']) ? rtrim(trim($_POST['url_new']), '/') : null;
//LOGGING
$POST_LOG = $_POST;
unset($POST_LOG['tables']);
unset($POST_LOG['plugins']);
unset($POST_LOG['dbpass']);
ksort($POST_LOG);
$date = @date('h:i:s');
$charset_client = @mysqli_character_set_name($dbh);
$log = <<<LOG



********************************************************************************
DUPLICATOR INSTALL-LOG
STEP2 START @ {$date}
NOTICE: Do not post to public sites or forums
********************************************************************************
CHARSET SERVER:\t{$charset_server}
CHARSET CLIENT:\t {$charset_client} 

LOG;
DUPX_Log::Info($log);
//Detailed logging
开发者ID:ICONVI,项目名称:sigmacatweb,代码行数:31,代码来源:ajax.step2.php

示例15: __construct

 /**
  *	Constructor.
  *	This create an opened connexion to a database server and eventually to a database
  *
  *	@param      string	$type		Type of database (mysql, pgsql...)
  *	@param	    string	$host		Address of database server
  *	@param	    string	$user		Nom de l'utilisateur autorise
  *	@param	    string	$pass		Mot de passe
  *	@param	    string	$name		Nom de la database
  *	@param	    int		$port		Port of database server
  *	@return	    int					1 if OK, 0 if not
  */
 function __construct($type, $host, $user, $pass, $name = '', $port = 0)
 {
     global $conf, $langs;
     // Note that having "static" property for "$forcecharset" and "$forcecollate" will make error here in strict mode, so they are not static
     if (!empty($conf->db->character_set)) {
         $this->forcecharset = $conf->db->character_set;
     }
     if (!empty($conf->db->dolibarr_main_db_collation)) {
         $this->forcecollate = $conf->db->dolibarr_main_db_collation;
     }
     $this->database_user = $user;
     $this->database_host = $host;
     $this->database_port = $port;
     $this->transaction_opened = 0;
     //print "Name DB: $host,$user,$pass,$name<br>";
     if (!function_exists("mysqli_connect")) {
         $this->connected = 0;
         $this->ok = 0;
         $this->error = "Mysqli PHP functions for using Mysqli driver are not available in this version of PHP. Try to use another driver.";
         dol_syslog(get_class($this) . "::DoliDBMysqli : Mysqli PHP functions for using Mysqli driver are not available in this version of PHP. Try to use another driver.", LOG_ERR);
         return $this->ok;
     }
     if (!$host) {
         $this->connected = 0;
         $this->ok = 0;
         $this->error = $langs->trans("ErrorWrongHostParameter");
         dol_syslog(get_class($this) . "::DoliDBMysqli : Erreur Connect, wrong host parameters", LOG_ERR);
         return $this->ok;
     }
     // Essai connexion serveur
     // We do not try to connect to database, only to server. Connect to database is done later in constrcutor
     $this->db = $this->connect($host, $user, $pass, '', $port);
     if ($this->db) {
         $this->connected = 1;
         $this->ok = 1;
     } else {
         // host, login ou password incorrect
         $this->connected = 0;
         $this->ok = 0;
         $this->error = mysqli_connect_error();
         dol_syslog(get_class($this) . "::DoliDBMysqli : Erreur Connect mysqli_connect_error=" . $this->error, LOG_ERR);
     }
     // Si connexion serveur ok et si connexion base demandee, on essaie connexion base
     if ($this->connected && $name) {
         if ($this->select_db($name)) {
             $this->database_selected = 1;
             $this->database_name = $name;
             $this->ok = 1;
             // If client connected with different charset than Dolibarr HTML output
             $clientmustbe = '';
             if (preg_match('/UTF-8/i', $conf->file->character_set_client)) {
                 $clientmustbe = 'utf8';
             }
             if (preg_match('/ISO-8859-1/i', $conf->file->character_set_client)) {
                 $clientmustbe = 'latin1';
             }
             if (mysqli_character_set_name($this->db) != $clientmustbe) {
                 $this->query("SET NAMES '" . $clientmustbe . "'", $this->db);
                 //$this->query("SET CHARACTER SET ". $this->forcecharset);
             }
         } else {
             $this->database_selected = 0;
             $this->database_name = '';
             $this->ok = 0;
             $this->error = $this->error();
             dol_syslog(get_class($this) . "::DoliDBMysqli : Erreur Select_db " . $this->error, LOG_ERR);
         }
     } else {
         // Pas de selection de base demandee, ok ou ko
         $this->database_selected = 0;
         if ($this->connected) {
             // If client connected with different charset than Dolibarr HTML output
             $clientmustbe = '';
             if (preg_match('/UTF-8/i', $conf->file->character_set_client)) {
                 $clientmustbe = 'utf8';
             }
             if (preg_match('/ISO-8859-1/i', $conf->file->character_set_client)) {
                 $clientmustbe = 'latin1';
             }
             if (mysqli_character_set_name($this->db) != $clientmustbe) {
                 $this->query("SET NAMES '" . $clientmustbe . "'", $this->db);
                 //$this->query("SET CHARACTER SET ". $this->forcecharset);
             }
         }
     }
     return $this->ok;
 }
开发者ID:ADDAdev,项目名称:Dolibarr,代码行数:99,代码来源:mysqli.class.php


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