change mime type of output in php

后端 未结 6 1438
时光取名叫无心
时光取名叫无心 2020-12-03 04:32

I\'ve got a php script. Most of the time the script returns html, which is working fine, but on one occasion (parameter ?Format=XML) the script returns XML instead of HTML.<

6条回答
  •  無奈伤痛
    2020-12-03 04:38

    You should send a Content-Type header before you send any output.

    header('Content-Type: text/xml');
    

提交回复
热议问题