使用PHP将图像下载到客户端 [英] Downloading an image to client side using PHP
问题描述
否。 PHP不会下载到客户端。客户端(即浏览器)可以从服务器下载,服务器可以使用PHP发送数据。
-
要发送单个图像,您必须设置正确的标题,以指定
图像的内容类型。见
http://www.ehow.com/how_7280601_send-php- image-file.html -
要发送多张图像,您可以发送多部分响应。
不幸的是,支持这种类型的响应很差。不要使用
它。 -
或者您可以发送带有
< img>
标签。
的URL可以是一个直接的文件位置,也可以是发送
a单个图像的PHP脚本,如1。
I have say 5 URLs of five images available from Google search. Now I wish to download them on client side. Any way to do it using PHP ?
No. PHP doesn't download to clients. The client (i.e. a browser) can download from a server, and the server may use PHP to send the data.
[edit]
To send a single image, you must set the right header, to specifiy the content type of the image. See http://www.ehow.com/how_7280601_send-php-image-file.html
To send multiple images, you could send a multipart response. Unfortunately support for this type of response is poor. Don't use it.
Or you can just send a html page with
<img>
tags in it. The url of the image can be a direct file location, or a PHP script that sends a single image, like in 1.
这篇关于使用PHP将图像下载到客户端的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!