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


PHP mysqli_client_encoding函数代码示例

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


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

示例1: __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_client_encoding(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:ragi79,项目名称:Textcube,代码行数:40,代码来源:Debug.php

示例2: getEncoding

 /**
  * Gets the database encoding
  *
  * @return string The database encoding
  */
 function getEncoding()
 {
     return mysqli_client_encoding($this->connection);
 }
开发者ID:sathishkumarb,项目名称:HVMS,代码行数:9,代码来源:dbo_mysqli.php

示例3: 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_client_encoding($this->database), "MySQL Character Set Settings" => join(", ", $charset_str));
 }
开发者ID:delkyd,项目名称:sugarcrm_dev,代码行数:9,代码来源:MysqliManager.php

示例4: addslashes

//$_POST['username'] = chr(0xbf).chr(0x5c).' OR username = username /*';
$_POST['password'] = 'guess';
echo "\n----addslashes-----\n";
echo $username = addslashes($_POST['username']);
echo "\n";
$password = addslashes($_POST['password']);
//echo $sql = "SELECT * FROM  users WHERE  username = '$username' AND password = '$password'";echo $sql = "SELECT * FROM  users WHERE  username = '$username'";
echo "\n";
$result = mysqli_query($db, $sql) or trigger_error(mysqli_error($db) . $sql);
var_dump(mysqli_num_rows($result));
var_dump(mysqli_client_encoding($db));
echo "\n---------\n";
echo $username = mysqli_real_escape_string($db, $_POST['username']);
echo "\n";
$password = mysqli_real_escape_string($db, $_POST['password']);
//$sql = "SELECT * FROM  users WHERE  username = '$username' AND password = '$password'";echo $sql = "SELECT * FROM  users WHERE  username = '$username'";
echo "\n";
$result = mysqli_query($db, $sql) or trigger_error(mysqli_error($db) . $sql);
var_dump(mysqli_num_rows($result));
var_dump(mysqli_client_encoding($db));
echo "\n---------\n";
mysqli_set_charset($db, "GBK");
echo $username = mysqli_real_escape_string($db, $_POST['username']);
echo "\n";
$password = mysqli_real_escape_string($db, $_POST['password']);
//$sql = "SELECT * FROM  users WHERE  username = '$username' AND password = '$password'";echo $sql = "SELECT * FROM  users WHERE  username = '$username'";
echo "\n";
$result = mysqli_query($db, $sql) or trigger_error(mysqli_error($db) . $sql);
var_dump(mysqli_num_rows($result));
var_dump(mysqli_client_encoding($db));
开发者ID:DZLZH,项目名称:dzlzh,代码行数:30,代码来源:addslashes_mysql_real_escape_string.php

示例5: call_user_method

call_user_method();
call_user_method_array();
define_syslog_variables();
dl();
ereg();
ereg_replace();
eregi();
eregi_replace();
import_request_variables();
mcrypt_generic_end();
mysql_db_query();
mysql_escape_string();
mysql_list_dbs();
mysqli_bind_param();
mysqli_bind_result();
mysqli_client_encoding();
mysqli_fetch();
mysqli_param_count();
mysqli_get_metadata();
mysqli_send_long_data();
magic_quotes_runtime();
session_register();
session_unregister();
session_is_registered();
set_magic_quotes_runtime();
set_socket_blocking();
split();
spliti();
sql_regcase();
php_logo_guid();
php_egg_logo_guid();
开发者ID:rrsc,项目名称:freemed,代码行数:31,代码来源:deprecated_functions.php

示例6: str_replace

# Check PHP version
$phpversion=phpversion();
$phpinifile=php_ini_loaded_file();
if ($phpversion<'4.4') {$result=$lang["status-fail"] . ": " . str_replace("?", "4.4", $lang["shouldbeversion"]);} else {$result=$lang["status-ok"];}
?><tr><td><?php echo str_replace("?", "PHP", $lang["softwareversion"]); ?></td><td><?php echo $phpversion .'&ensp;&ensp;' . str_replace("%file", $phpinifile, $lang["config_file"]);?></td><td><b><?php echo $result?></b></td></tr><?php

# Check MySQL version
if ($use_mysqli){
	$mysqlversion=mysqli_get_server_info($db);
	}
else {
	$mysqlversion=mysql_get_server_info();
	}
if ($mysqlversion<'5') {$result=$lang["status-fail"] . ": " . str_replace("?", "5", $lang["shouldbeversion"]);} else {$result=$lang["status-ok"];}
if ($use_mysqli){$encoding=mysqli_client_encoding($db);} else {$encoding=mysql_client_encoding();}
?><tr><td><?php echo str_replace("?", "MySQL", $lang["softwareversion"]); ?></td><td><?php echo $mysqlversion . "&ensp;&ensp;" . str_replace("%encoding", $encoding, $lang["client-encoding"]); ?></td><td><b><?php echo $result?></b></td></tr><?php

# Check GD installed
if (function_exists("gd_info"))
	{
	$gdinfo=gd_info();
	if (is_array($gdinfo))
		{
		$version=$gdinfo["GD Version"];
		$result=$lang["status-ok"];
		}
	else
		{
		$version=$lang["status-notinstalled"];
		$result=$lang["status-fail"];
开发者ID:Jtgadbois,项目名称:Pedadida,代码行数:30,代码来源:check.php

示例7: client_encoding

 function client_encoding()
 {
     return mysqli_client_encoding($this->connect_id);
 }
开发者ID:Saleh7,项目名称:Kleeja,代码行数:4,代码来源:mysqli.php

示例8: getCharset

 /**
  * {@inheritdoc}
  */
 public function getCharset()
 {
     return mysqli_client_encoding($this->connection);
 }
开发者ID:speedwork,项目名称:database,代码行数:7,代码来源:MysqliDriver.php

示例9: mysqli_get_server_info

echo $result;
?>
</b></td></tr><?php 
# Check MySQL version
if ($use_mysqli) {
    $mysqlversion = mysqli_get_server_info($db);
} else {
    $mysqlversion = mysql_get_server_info();
}
if ($mysqlversion < '5') {
    $result = $lang["status-fail"] . ": " . str_replace("?", "5", $lang["shouldbeversion"]);
} else {
    $result = $lang["status-ok"];
}
if ($use_mysqli) {
    $encoding = mysqli_client_encoding($db);
} else {
    $encoding = mysql_client_encoding();
}
?>
<tr><td><?php 
echo str_replace("?", "MySQL", $lang["softwareversion"]);
?>
</td><td><?php 
echo $mysqlversion . "&ensp;&ensp;" . str_replace("%encoding", $encoding, $lang["client-encoding"]);
?>
</td><td><b><?php 
echo $result;
?>
</b></td></tr><?php 
# Check GD installed
开发者ID:vongalpha,项目名称:resourcespace,代码行数:31,代码来源:check.php

示例10: DoliDb

    /**
     *	Ouverture d'une connexion vers le serveur et eventuellement une database.
     *	@param     type		Type de base de donnees (mysql ou pgsql)
     *	@param	   host		Addresse de la base de donnees
     *	@param	   user		Nom de l'utilisateur autorise
     *	@param	   pass		Mot de passe
     *	@param	   name		Nom de la database
     *	@param	   port		Port of database server
     *	@return    int		1 en cas de succes, 0 sinon
     */
    function DoliDb($type='mysqli', $host, $user, $pass, $name='', $port=0)
    {
        global $conf,$langs;

        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->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("DoliDB::DoliDB : 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("DoliDB::DoliDB : 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("DoliDB::DoliDB : 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_client_encoding($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("DoliDB::DoliDB : 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_client_encoding($this->db) != $clientmustbe)
                {
//.........这里部分代码省略.........
开发者ID:remyyounes,项目名称:dolibarr,代码行数:101,代码来源:mysqli.lib.php


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