Home > php教程 > php手册 > body text

完美解决PHP中文乱码

WBOY
Release: 2016-06-06 19:55:24
Original
810 people have browsed it

用jsp时中文乱码就是一个很棘手的问题,最近要开始写项目了,觉得解决中文乱码是和有必要的。故google, 做了小总结,与大家分享。老鸟勿喷。。。。 一、首先是PHP网页的编码 1. php文件本身的编码与网页的编码应匹配 a. 如果欲使用gb2312编码,那么php要输

用jsp时中文乱码就是一个很棘手的问题,最近要开始写项目了,觉得解决中文乱码是和有必要的。故google,
         做了小总结,与大家分享。老鸟勿喷。。。。


一、首先是PHP网页的编码
1.     php文件本身的编码与网页的编码应匹配
a.     如果欲使用gb2312编码,那么php要输出头:header(“Content-Type: text/html; charset=gb2312"),静态页面添加

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 Recommendations
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!