开发者

Setup differences php 5.2 and 5.3

开发者 https://www.devze.com 2023-03-25 08:43 出处:网络
I have a php that generates a XML file. It begins with the following code: header(\"Content-Type: text/xml; charset=UTF-8\");

I have a php that generates a XML file. It begins with the following code:

header("Content-Type: text/xml; charset=UTF-8");
header('Content-Disposition: attachment; filename="FileName.xml"');

// Outputs a lot o开发者_开发百科f XML

When I'm running PHP 5.2 it works fine, but on 5.3 an empty file is generated. Any ideas about why it's empty?


this sounds like it could be related to short open tags functionality: <? vs <?php?

make sure you have short open tags disabled in your php.ini. if you need it activated, there's a workaround: for <?xml tag, wrap it in a string and echo it, so it will not be interpreted as the start of a php block by php

echo '<?xml … >';
0

精彩评论

暂无评论...
验证码 换一张
取 消