七牛云上传的图片进行删除
生活随笔
收集整理的這篇文章主要介紹了
七牛云上传的图片进行删除
小編覺得挺不錯的,現在分享給大家,幫大家做個參考.
PHP方法:
/*** 七牛云商品圖片刪除2017/10/25*/
public function delGoodsImg() {$this->isShopLogin();$img = I("imgUrl");$res = $this->qiNiuDelImg($img);if ($res['status'] != 1) {//七牛里沒有圖片時,但數據庫里有數據時if (!empty($res['err']) && !empty($img)) {$gg = M("goods_gallerys");$where['goodsImg'] = "http://ang.com/" . $img;$imgInfo = $gg->where($where)->find();if (!empty($imgInfo)) {$res = $gg->where($where)->delete();}}$this->ajaxReturn($res['err']);} else {$gg = M("goods_gallerys");$where['goodsImg'] = "http:/g.com/" . $img;$imgInfo = $gg->where($where)->find();if (!empty($imgInfo)) {$res = $gg->where($where)->delete();}$this->ajaxReturn("ok");}
}配置刪除路徑 :var delimg="{:U('Home/Goods/delGoodsImg')}";
//刪除退貨上傳的圖片$(document).on("click",".lst1106-SC", function(){$(this).parent().remove();var imgSrc = $(this).parent().children('img').attr('src');var index = imgSrc.lastIndexOf("\/");var name = imgSrc.substring(index + 1,imgSrc.length);console.log(imgSrc)console.log(name)$.post(delimg, { imgUrl: name }, function(data) {console.log(data);});});打印結果:
http://image.jianfengwang.com/o_1c43gn8k15e01ia0tt0898fe9.jpgo_1c43gn8k15e01ia0tt0898fe9.jpgok
?
轉載于:https://www.cnblogs.com/lst619247/p/8308884.html
總結
以上是生活随笔為你收集整理的七牛云上传的图片进行删除的全部內容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: IDEA2017注册码
- 下一篇: 借助Docker单机秒开数十万TCP连接