簡體   English   中英

php發送charset標頭,但沒有標頭命令

[英]php sends charset header but there is no header command

我的瀏覽器顯示頁面編碼錯誤。 我發現服務器發送標頭

HTTP/1.1 200 OK
Date: Thu, 02 Jan 2014 18:21:11 GMT
Server: Apache/2.2.4 (Win32) mod_ssl/2.2.4 OpenSSL/0.9.8k PHP/5.2.12
X-Powered-By: PHP/5.2.12
Content-Length: 4
Keep-Alive: timeout=5, max=100
Connection: Keep-Alive
Content-Type: text/html; charset=windows-1251

php腳本不包含編碼設置命令。 我什至在腳本頂部添加了exit功能,瀏覽器仍然獲得Content-Type: text/html; charset=windows-1251 Content-Type: text/html; charset=windows-1251 怎么會這樣?

首先查看php.ini中的default_charset 如果您不想使用Content-Type標頭,請將其保留為空。

在PHP中,總是可以執行header('Content-Type', 'text/html; charset=UTF-8');

Apache也有一個Content-Type的配置,但是錯誤可能出在PHP端。

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM