php取mysql,上传到服务器后,显示中文为乱码

WBOY
Release: 2016-06-02 11:28:37
Original
901 people have browsed it

php

数据表是utf8_general_ci编码,字段值
首页宽幅幻灯片
对应的是
首页宽幅幻灯片

<code> <meta http-equiv="Content-Type" content="text/html; charset=utf-8">...//mysql_query( "SET NAMES UTF8" );$result = mysql_query( "SELECT name FROM info_category LIMIT 1" );if ( $result ){    while( $row = mysql_fetch_array($result) )    {        echo "<br>". $row['name'];    }}</code>
Copy after login

我在开发机器上安装XAMPP,调试显示是正确的。上传到服务器上运行,从数据库取来的中文就显示成乱码了。

同样的测试代码文件,显示结果却不一样,怎么办?

我检查了数据库编码,尝试set names,在服务器上都不行。服务器操作系统是linux,开发机是windows,和操作系统没关系吧。

Related labels:
php
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!