Warning: file_get_contents(/data/phpspider/zhask/data//catemap/8/mysql/55.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
无法使用Php7和Mysql导出到Excel_Mysql_Excel_Php 7 - Fatal编程技术网

无法使用Php7和Mysql导出到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

我需要将mysql数据导入excel文件。我用的是php7。我写了一个代码,但问题是所有数据都打印在excel文件的一列中。有人能帮我修改excel文件中的行和列的代码吗。 这是我的代码: ` 尝试使用以下方法:

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");