使用PHP将图像下载到客户端 [英] Downloading an image to client side using PHP

查看:270
本文介绍了使用PHP将图像下载到客户端的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我已经说过5个可以从Google搜索的图片的5个网址。现在我想在客户端下载它们。任何方式使用PHP?

解决方案

否。 PHP不会下载到客户端。客户端(即浏览器)可以从服务器下载,服务器可以使用PHP发送数据。






  1. 要发送单个图像,您必须设置正确的标题,以指定
    图像的内容类型。见
    http://www.ehow.com/how_7280601_send-php- image-file.html


  2. 要发送多张图像,您可以发送多部分响应。
    不幸的是,支持这种类型的响应很差。不要使用
    它。


  3. 或者您可以发送带有< 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]

  1. 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

  2. To send multiple images, you could send a multipart response. Unfortunately support for this type of response is poor. Don't use it.

  3. 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屋!

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