天天看点

为什么写header("Content-type: text/html; charset=utf-8");

.php文件中有汉字,但是在浏览器中是乱码,

原因就是php文件没有定义编码,那就去定义php文件的编码,

那么就在php文件中写header("Content-type: text/html; charset=utf-8");

相当于写了一个<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />

php