无法使用Php7和Mysql导出到Excel
我需要将mysql数据导入excel文件。我用的是php7。我写了一个代码,但问题是所有数据都打印在excel文件的一列中。有人能帮我修改excel文件中的行和列的代码吗。 这是我的代码: ` 尝试使用以下方法:无法使用Php7和Mysql导出到Excel,mysql,excel,php-7,Mysql,Excel,Php 7,我需要将mysql数据导入excel文件。我用的是php7。我写了一个代码,但问题是所有数据都打印在excel文件的一列中。有人能帮我修改excel文件中的行和列的代码吗。 这是我的代码: ` 尝试使用以下方法: header ("Content-Type: application/vnd.ms-excel"); header ("Content-Disposition: inline; filename=download.xls"); 而不是 header("Content-Type: ap
header ("Content-Type: application/vnd.ms-excel");
header ("Content-Disposition: inline; filename=download.xls");
而不是
header("Content-Type: application/xls");
header("Content-Disposition: attachment; filename=download.xls");
你可以找到一个很好的教程。我不是很确定,但这不是一种合法的excel导出方式,但是你可以尝试在头和文件名扩展名处使用xlsx而不是xls,直到没有得到@Santa'shelper。你能提供一些其他转换方法吗?提前感谢这里有一个PHP库,名为我没有尝试,因为我得到了输出。谢谢
header("Content-Type: application/xls");
header("Content-Disposition: attachment; filename=download.xls");