Home > Backend Development > PHP Tutorial > PHP抓图图片问题

PHP抓图图片问题

WBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWB
Release: 2016-06-06 20:26:14
Original
1158 people have browsed it

项目前期为了方便使用php自带的copy函数抓取其他网站图片,最近出现很多问题,抓图经常失败;保存下来的图片文件是个空文件;

有没有人遇到过,是什么原因导致的,顺便请教下各位,php抓取图片的方案以及需要注意的问题;

回复内容:

项目前期为了方便使用php自带的copy函数抓取其他网站图片,最近出现很多问题,抓图经常失败;保存下来的图片文件是个空文件;

有没有人遇到过,是什么原因导致的,顺便请教下各位,php抓取图片的方案以及需要注意的问题;

配合file_get_contentsfile_put_contents两个函数

<code><?php $img_url = 'http://www.baidu.com/img/bd_logo1.png';
$content = file_get_contents($img_url);
file_put_contents("1.jpg",$content);</code></code>
Copy after login
Related labels:
php
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
Latest Issues
php data acquisition?
From 1970-01-01 08:00:00
0
0
0
PHP extension intl
From 1970-01-01 08:00:00
0
0
0
How to learn php well
From 1970-01-01 08:00:00
0
0
0
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template