douzhao5656 2013-12-03 13:24
浏览 67
已采纳

下载xml文件后重定向[重复]

This question already has an answer here:

I use the following code to download an xml file

<?php
header('Content-type: text/xml');
header('Content-Disposition: attachment; filename="download.xml"');
echo simplexml_load_file('temp.xml');
unlink('temp.xml');
?>

I would like to redirect to index.php after this. How do I do this?

header('location...) and meta refresh do not work

</div>
  • 写回答

2条回答 默认 最新

  • dongqiao3833 2013-12-03 13:28
    关注

    Well because you send the header and content this can't be done.

    You have to redirect first and then let the file download on the target site.

    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论
查看更多回答(1条)

报告相同问题?

悬赏问题

  • ¥15 企业资源规划ERP沙盘模拟
  • ¥15 前端echarts坐标轴问题
  • ¥15 CMFCPropertyPage
  • ¥15 ad5933的I2C
  • ¥15 请问RTX4060的笔记本电脑可以训练yolov5模型吗?
  • ¥15 数学建模求思路及代码
  • ¥50 silvaco GaN HEMT有栅极场板的击穿电压仿真问题
  • ¥15 谁会P4语言啊,我想请教一下
  • ¥15 这个怎么改成直流激励源给加热电阻提供5a电流呀
  • ¥50 求解vmware的网络模式问题 别拿AI回答