PHPExcel $ objWriter->保存()失败 [英] PHPExcel $objWriter->save() fails
问题描述
我创建从PHPExcel数据库的基础上记录的Excel文件和大型数据集生成它,当我面临着一个奇怪的问题。我已经把范围缩小到一个导致问题的行:
I am creating an Excel file based on records from a database with PHPExcel and am facing an odd problem when generating it on a large data set. I have narrowed it down to a single problem-causing line:
$objWriter->save('php://output');
这只是吐出了一个空白的文件,而不是预期的工作簿。此外,效果类似,如果我试图将结果保存到本地文件,而不是重定向到浏览器 - 没有文件被创建
It just spits out a blank file instead of the expected workbook. Also, the effect is similar if I try to save the result into a local file instead of redirecting to the browser - no file is ever created.
起脚是,它完全适用于一个更小的数据集(较小=高达200行,更大=多达2000行,最大20列在这两种情况下)。它也能正常工作的服务器上的其他(开发)具有的完全一样的,100%相同的,大的数据集。
The kicker is that it works perfectly for a smaller data set (smaller = up to 200 rows, larger = up to 2000 rows, up to 20 columns in both cases). It also works fine on another (development) server with an EXACT SAME, 100% identical, large dataset.
我确实有保存()
调用包装在一个try-catch,但没有异常。执行 memory_get_peak_usage()
权去为保存()
告诉我,这是使用24MB,在此之前,我有的ini_set('memory_limit的','-1')
。此外,监控服务器上的内存使用,同时运行该脚本不显示任何显著的增加无论是。
I do have the save()
call wrapped in a try-catch but no exception is raised. Executing memory_get_peak_usage()
right before going for save()
tells me that it was using 24MB, and I have ini_set('memory_limit', '-1')
earlier in the script. Also, monitoring memory usage on the server while running the script does not show any significant increase either.
有关调试它任何提示?
编辑:有在Apache日志中没有错误,但是我也注意到,在访问日志中的相关行说:
there are no errors in apache logs, however I did notice that the relevant line in access logs says:
10.1.1.1 - - [01/Jun/2011:08:35:03 -0400] "GET /get_excel.php HTTP/1.1" 200 16386
奇怪的部分是最后一列 - 大小。该文件其实我去下载总是空 - 恰好为0位,而不是16386
The odd part is the last column - size. The file I actually get to download is always empty - exactly 0 bits, not 16386.
推荐答案
根据您在我想你没有满足所有要求的意见给了反馈。你可以找到的要求这里phpexcel网站。
Based on the feedback you gave in the comments I think you do not meet all the requirements. You can find the list of the requirements here on the phpexcel website.
这篇关于PHPExcel $ objWriter->保存()失败的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!