php force download xml

前端 未结 3 2012
星月不相逢
星月不相逢 2021-01-03 07:42

I am creating an xml file on the fly. When a user generates this file I want it to open up a download file dialog with the content that was generated. There is no actual fil

3条回答
  •  生来不讨喜
    2021-01-03 08:11

    This is what worked for me. In readfile('newfile.xml'); make sure to give the path of the file correctly. This php page is called from an html page with anchor tag which says - download:

    
    

    source: How do I force the browser to download a file to disk instead of playing or displaying it?

提交回复
热议问题