这让我很头疼。已经 4 个小时了,我只是绕着它转:(。我的问题是当我从 mysql 获取大结果到 php 时它没有显示任何东西。总结果大约有 20000 多个数据。所以我所做的是限制结果为 1000,它确实按预期显示了结果。
是否需要设置或更改某些配置?
下面是我的示例查询
不起作用(当结果超过 10000 时)
select * from `tbl_item` where `pricelist_id` = 1 and `published` = 'unpublished' and `type` = 'item' and `parent_id` = 0 and `tbl_item`.`status` <> 'inactive' order by `order` asc limit 10000
工作(只需将结果限制为 1000)
select * from `tbl_item` where `pricelist_id` = 1 and `published` = 'unpublished' and `type` = 'item' and `parent_id` = 0 and `tbl_item`.`status` <> 'inactive' order by `order` asc limit 1000
奇怪。帮助任何人。
问候,
最佳答案
也许结果集占用了太多内存。这会导致 fatal error ,您是否激活了 error_reporting?
ini_set('display_errors', 1);
error_reporting(-1);
您可以通过将此添加到您的脚本来设置更高的内存限制:
ini_set('memory_limit', '2048M'); // would be really high, but good enough to investigate on the problem
然后您可以使用memory_get_peak_usage()
来显示...嗯,内存消耗的峰值
关于php - 如果结果大则不显示结果,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/37742433/