- 论坛徽章:
- 0
|
本帖最后由 qulthalasbard 于 2010-07-27 21:20 编辑
本人新手 业余学习
<html>
<title>111</title>
<body>
<?php
$xtt = mysql_connect("localhost","root","dabai2008");
mysql_query("set names utf8");
echo mysql_client_encoding($xtt);
?>
</body>
</html>
如上编码php -f 结果现实latin1
而且确实不能在网页现实中文
mysql> show variables like 'chara%';
+--------------------------+----------------------------+
| Variable_name | Value |
+--------------------------+----------------------------+
| character_set_client | utf8 |
| character_set_connection | utf8 |
| character_set_database | utf8 |
| character_set_filesystem | binary |
| character_set_results | utf8 |
| character_set_server | utf8 |
| character_set_system | utf8 |
| character_sets_dir | /usr/share/mysql/charsets/ |
+--------------------------+----------------------------+
[root@localhost html]# rpm -qa|grep php
php-common-5.1.6-23.2.el5_3
php-cli-5.1.6-23.2.el5_3
php-5.1.6-23.2.el5_3
php-mysql-5.1.6-23.2.el5_3
php-pdo-5.1.6-23.2.el5_3
php-ldap-5.1.6-23.2.el5_3
这该如何是好,就是如何设置php连接mysql的编码?难道我的mysql_query(“set names utf8")无效?或者我的php少装了什么组件? |
|