簡體   English   中英

不要在標題中設置字符集

[英]Don't set charset in header

如何避免發送內容類型時,PHP(或Apache)自動將charset = utf-8添加到Content-type eader中?

(原因是這導致了Internet Explorer的問題)

orange public$ cat test.php 
<?php

header('Content-Type: text/xml');
orange public$ curl -v example.com.orange.me.local/test.php
#*   Trying 10.0.0.1...
* Connected to example.com.orange.me.local (10.0.0.1) port 80 (#0)
> GET /test.php HTTP/1.1
> Host: example.com.orange.imi.local
> User-Agent: curl/7.47.0
> Accept: */*
> 
< HTTP/1.1 200 OK
< Date: Wed, 01 Jun 2016 16:24:49 GMT
< Server: Apache/2.4.18 (Ubuntu)
< Content-Length: 0
< Content-Type: text/xml;charset=UTF-8
< 
* Connection #0 to host example.com.orange.me.local left intact

我可以使用刪除字符集

ini_set('default_charset', '');

在我的腳本中

AddDefaultCharset off

在我的.htaccess中

暫無
暫無

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

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