change mime type of output in php

后端 未结 6 1456
时光取名叫无心
时光取名叫无心 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:41

    Set the Content-Type header:

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

    Though you should probably use "application/xml" instead.

提交回复
热议问题