内容类型可能是?

时间:2010-10-25 18:34:01

标签: php xml

我保存了一个xml文件,这就是我想要做的事情,

当某人单击包含xml文件的链接时,我希望他们询问是否要保存或打开文件的问题。

我知道有一种方法可以使用http标头发送并欺骗你的浏览器使用application / octet-stream mime类型,但我忘记了它是如何完成的。 .. 它给了我这个错误

The XML page cannot be displayed 
Cannot view XML input using style sheet. Please correct the error and then click the Refresh button, or try again later. 


--------------------------------------------------------------------------------

XML document must have a top level element. Error processing resource 'file:///C:/Documents and 

1 个答案:

答案 0 :(得分:3)

尝试添加Content-Disposition标头:

Content-Disposition: attachment; filename="yourfile.xml"

当然,XML Content-Type标题也是:

Content-type: text/xml