码迷,mamicode.com
首页 > 其他好文 > 详细

图片下载

时间:2018-03-12 20:58:31      阅读:160      评论:0      收藏:0      [点我收藏+]

标签:qrcode   isp   adf   http   cte   php   cep   res   nts   

<?php
/* ob_start();
$filename=‘https://mp.weixin.qq.com/cgi-bin/showqrcode?ticket=gQF_8TwAAAAAAAAAAS5odHRwOi8vd2VpeGluLnFxLmNvbS9xLzAyeU5KY2xVRFlmY2oxMDAwME0wM0UAAgTM9aVaAwQAAAAA‘;
$date=date("Ymd-H:i:m");
header( "Content-type:   application/octet-stream ");
header( "Accept-Ranges:   bytes ");
header( "Content-Disposition:   attachment;   filename= aa.png");
$size=readfile($filename);
header( "Accept-Length: " .$size); */

$url = "https://mp.weixin.qq.com/cgi-bin/showqrcode?ticket=gQF_8TwAAAAAAAAAAS5odHRwOi8vd2VpeGluLnFxLmNvbS9xLzAyeU5KY2xVRFlmY2oxMDAwME0wM0UAAgTM9aVaAwQAAAAA";
$image_content = file_get_contents($url);
$http_type = get_headers($url);
$result = explode(‘/‘,$http_type[3]);
$type = ‘png‘;
file_put_contents(‘aaa.‘.$type,$image_content);

  

图片下载

标签:qrcode   isp   adf   http   cte   php   cep   res   nts   

原文地址:https://www.cnblogs.com/zhangxiangdong/p/8550686.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!