在PHP数组的大小限制 [英] Array size limit in PHP

查看:132
本文介绍了在PHP数组的大小限制的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想知道有没有在PHP 5阵列的大小限制?我写了一个PHP脚本修改每一行的最后一个元素在文件中。 打印出修改后的文件的内容,当我运行上的小尺寸的文件中的脚本(即每行包括4个值),它将工作。当我在一个较大的文件运行(如60000行,每一行的包括90值),它不会改了一下原始文件,但在运行时脚本未抛出任何异常信息。这是什么问题呢?

I am wondering is there a size limit for array in php 5? I wrote a php script to change the last element of each line in a file. print out the content of a modified file, when I run the script on a small-sized file (i.e. each line comprises 4 values), it will work. When I run it on a larger file (like 60000 lines, each of which comprises 90 values), it does not change a bit of the original file, but the script did not throw any exception message during runtime. What is this problem?

推荐答案

您可运行内存,为您的数组大小是(理论上)只分配给脚本的内存量的限制。
的ini_set('memory_limit的','1024M'); 在你的脚本的内存限制设置为1 GB的开始。您可能需要增加这个还要高以获得最佳效果。

You could be running out of memory, as your array size is (in theory) only limited by the amount of memory allocated to the script. Put ini_set('memory_limit', '1024M'); in the beginning of your script to set the memory limit to 1 GB. You may need to increase this even higher for best results.

这篇关于在PHP数组的大小限制的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆