Force Download CSV File

后端 未结 3 1593
半阙折子戏
半阙折子戏 2020-12-06 10:35

I am trying to create a button that will force a CSV file download but for some reason I am not able to get it working. This is the code that I have:

public          


        
3条回答
  •  执念已碎
    2020-12-06 11:17

    you need to echo your content after the header

    header('Content-Description: File Transfer');
    header('Content-Type: application/force-download');
    header('Content-Disposition: attachment; filename=pedidos.csv');
    echo $shtml
    

提交回复
热议问题