标签:缓冲 down 清空 成功 com pst tps 失败 contents
public function downimg() { $path = ‘E:/phpstudy_pro/WWW/pachong/public/uploads/img/‘; $img ="https://zy.yaozh.com/instruct/imagesout/TB1_wMKSpXXXXalXXXXXXXXXXXX_!!0-item_pic.jpg_430x430q90.jpg" ; ob_clean(); ob_start(); readfile($img); //读取图片 $img = ob_get_contents(); //得到缓冲区中保存的图片 ob_end_clean(); //清空缓冲区 $fp = fopen($path.‘test.jpg‘,‘w‘); //写入图片 if(fwrite($fp,$img)) { fclose($fp); echo "图片保存成功"; }else{ echo "图片保存失败"; } }
标签:缓冲 down 清空 成功 com pst tps 失败 contents
原文地址:https://www.cnblogs.com/zxf100/p/14479281.html