Home > Backend Development > PHP Tutorial > imagecreatefrompng频繁调用Warning: imagecreatefrompng(): Cannot read image data,该怎么处理

imagecreatefrompng频繁调用Warning: imagecreatefrompng(): Cannot read image data,该怎么处理

WBOY
Release: 2016-06-13 11:56:11
Original
1461 people have browsed it

imagecreatefrompng频繁调用Warning: imagecreatefrompng(): Cannot read image data
两服务器(linux)A、B:A机器上imagecreatefrompng(url)循环重复正常,B机器上执行多次后,报错Warning: imagecreatefrompng(): Cannot read image data,报错多次后,imagecreatefrompng又能正常执行,然后又报错----正常-- 报错。。。;报错次数和正常执行次数都不是固定规律。A、Bphp版本都是5.3。php.ini一样。如果是url服务器上,有防止频繁访问,那么A、B应该同样现象吧。真不知道是那个地方配置有问题???imagecreatefrompng换成imagecreatefromstring(file_get_contents(url))现象也一样。
------解决方案--------------------
if($s = file_get_contents(url)) {
  $im = imagecreatefromstring($s);
  ....
}

读取远程数据偶有失败是很正常的

Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template