这让我头疼。已经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


奇怪的。帮助任何人。

问候,

最佳答案

可能结果集占用了太多内存。这将导致致命错误,您是否激活了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/

10-16 23:17