What is the best way to create XLS file in PHP

后端 未结 9 1274
予麋鹿
予麋鹿 2020-12-05 14:03

I am currently trying to figure out the best way to create a .xls file from PHP. It seems like to me that all I need to do is change the header content type to \"application

9条回答
  •  温柔的废话
    2020-12-05 14:50

    its pretty easy, because excel supports html code. So you just need to add a header in the top of the file.. and then echo your html code!

    header ( "Content-type: application/vnd.ms-excel" );
    header ( "Content-Disposition: attachment; filename=foo_bar.xls" );
    echo "
    Header1
    value1
    ";

    this will generate an excel file!

提交回复
热议问题