Home  >  Article  >  Backend Development  >  PHP中文乱码的常见解决办法总结

PHP中文乱码的常见解决办法总结

WBOY
WBOYOriginal
2016-06-13 12:23:38875browse

PHP中文乱码的常见解决方法总结

PHP中文乱码是PHP开发中的常见问题之一。PHP中文乱码有时发生在网页本身,有些产生在于MySQL交互的过程中,有时与操作系统有关。下面进行一番总结。

一.首先是PHP网页的编码

1. php文件本身的编码与网页的编码应匹配

a. 如果欲使用gb2312编码,那么php要输出头:header(“Content-Type: text/html; charset=gb2312"),静态页面添加

Statement:
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