易截截图软件、单文件、免安装、纯绿色、仅160KB

解决PHP内存溢出的问题

Allowed memory size of 33554432 bytes exhausted (tried to allocate 4554 bytes)
      有时候我们在运行php程序的时候会发现 Fatal Error: Out of memory 这样的提示。 这有可能是程序中用到了大量了变量和对象,导致分配的内存不够用。我就遇到这样一个错误怎么改也改不了,后来上网查了一些资料,可是修改了php.ini文件里的memory_limit参数,可是无论我怎么改还是有这个错误提示,特别郁闷!后来我实在没有办法了,就在QQ群里面求助,有人告诉我在我的程序代码中加入“init_set("memory_limit", "128M");”这行代码就可以了,于是我试了一下,还真的行了。现在我把自己解决这个问题的两种办法分享给大家,希望能帮到和我一样遇到类似问题的人们。
方法一:我们可以在php.ini文件中把memory_limit参数默认的128M修改为256M或者更大:
memory_limit = 128M
方法二:如果是虚拟主机,我们可以在程序需要用到大内存的地方添加:
init_set("memory_limit", "128M");
这些可以在硬件环境方面解决我们的问题,不过最好的方法还是严格控制程序中内存的损耗。及时unset一些大而不用的变量或对象。


相关文档:

php表达式之explode() 分割字符串

原帖地址:http://www.phpma.com/english/20071215/640.html
Description
array explode
( string separator, string string [, int limit])phpma.com
Returns an array of strings, each of which is a substring of string
formed by splitting it on boundaries formed by the string separator
. If limit
is ......

flash + php 文件上传

 import flash.net.FileFilter;
import flash.net.FileReferenceList;
import fl.controls.Button;
import flash.events.MouseEvent;
import flash.events.Event;
import flash.events.ProgressEvent;
import flash.events.HTTPStatusEvent;
import flash.display.Loader;
import flash.net.URLRequest;
var ......

PHP安装问题:编译安装php5.2.0时出错解决方案

编译安装php5.2.0时出错解决方案
1.错误信息...................如下
checking for mcrypt support... no
checking for mhash support... no
checking whether to include mime_magic support... no
checking for MING support... no
checking for mSQL support... no
checking for MSSQL support via FreeTDS ......

PHP 一些知识

1.取得当前内存使用大小:memory_get_usage()
2.计算执行时间:microtime(true)
3.设置script执行时间限制set_time_limit
4.设置内存限制ini_set("memory_limit","256M");
3.从远程下载文件的两个方法:
$contents=file_get_contents("http://www.govtrack.us/data/us/gis/zip4dist-prefix.t ......
© 2009 ej38.com All Rights Reserved. 关于E健网联系我们 | 站点地图 | 赣ICP备09004571号