你这样<?php

$conn = mysql_connect('localhost', 'root', '');

mysql_select_db('test');

$res = mysql_query("show variables like '%char%'");

$rows = array();

while ($rows[] = mysql_fetch_assoc($res));

print_r($rows);

mysql_query('set names "gbk";');

$res = mysql_query("show variables like '%char%'");

$rows = array();

while ($rows[] = mysql_fetch_assoc($res));

print_r($rows);

看返回结果, 我这边结果:Array

(

[0] => Array

(

[Variable_name] => character_set_client

[Value] => utf8

)

...

)

Array

(

[0] => Array

(

[Variable_name] => character_set_client

[Value] => gbk

)

...

)


评论关闭
IT干货网

微信公众号号:IT虾米 (左侧二维码扫一扫)欢迎添加!