分享
  • 收藏
  • 举报
    X
    (研究成功了)求助;百度编辑器的ueditor.all.js加一个方法
    • 福建宝岛眼镜莆田黄石分公司 消费2426.51元 2021-09-09 09:57 09:57
    789
    3





    php端不需要你写:php返回:删除成功返回1 不成功0


    ueditor.all.js 28917行添加;

           '<span onclick=$$._onImgSetFloat("delGoodsdescpic") class="edui-clickable">删除</span>&nbsp;&nbsp;'+

    10967行添加:

    case 'delGoodsdescpic':
    UE.ajax.request('sethello.php', {
                  //请求方法。可选值: 'GET', 'POST',默认值是'POST'
                  method: 'POST',
                  //超时时间。 默认为5000, 单位是ms
                  timeout: 10000,
                  //是否是异步请求。 true为异步请求, false为同步请求
                  async: true,
                  //请求携带的数据。如果请求为GET请求, data会经过stringify后附加到请求url之后。
                  data: {
                      act: 'delGoodsdescpic',picurl:img.getAttribute("src")
                  },
                  //请求成功后的回调, 该回调接受当前的XMLHttpRequest对象作为参数。
                  onsuccess: function ( xhr ) {
                      console.log( xhr.responseText );
    		    var con = JSON.parse(xhr.responseText);
                        if(con['error'] == 0){
    me.execCommand('deleteimage',{});//接下来研究这个,有帮忙的提示一下O(∩_∩)O谢谢
    
                            if(con['content'] == 3){
                                alert('带http本地图片且服务器存在图片删除成功:'+img.getAttribute("src"));
                            }else if(con['content'] == 4){
                                alert('带http本地图片且服务器存在图片删除失败:'+img.getAttribute("src"));
                            }else if(con['content'] == 5){
                                alert('带http本地图片且服务器不存在的或已经被删除的图片:'+img.getAttribute("src"));
                            }else if(con['content'] == 6){
                                alert('带http外部图片无需删除:'+img.getAttribute("src"));
                            }else if(con['content'] == 7){
                                alert('不带http本地图片删除成功:'+img.getAttribute("src"));
                            }else if(con['content'] == 8){
                                alert('不带http本地图片删除失败:'+img.getAttribute("src"));
                            }else if(con['content'] == 9){
                                alert('收到空的url图片地址:'+img.getAttribute("src"));
                            }
                        }else{
                            alert("删除出错");
                        }
                  },
                  //请求失败或者超时后的回调。
                  onerror: function ( xhr ) {
                       alert('delGoodsdescpicAjax请求失败');
                  }
    });
    
    
    
    
    
    
    
    
                            break;
    这句:me.execCommand('deleteimage',{});//接下来研究这个,有帮忙的提示一下O(∩
    换成:domUtils.remove(img);
    成功了
        if(!empty(trim($_POST['picurl']))){
            $picurl   = (!get_magic_quotes_gpc())?stripslashes(trim($_POST['picurl'])):trim($_POST['picurl']);
            if (strpos($picurl, 'http://';) === 0 || strpos($picurl, 'https://';) === 0 || strpos($picurl, 'www.') === 0)
            {
                if (strpos($picurl, 'http://www.nnn.com';) === 0 || strpos($picurl, 'https://www.nnn.com';) === 0 || strpos($picurl, 'www.nnn.com') === 0)
                {
                    $picurlarr = parse_url($picurl);
                    if(is_file('../' . $picurlarr['path'])){
                        if(unlink('../' . $picurlarr['path'])){
                            die(3);//$picurl.'带http本地图片且服务器存在图片删除成功'
                        }else{
                            die(4);//$picurl.'带http本地图片且服务器存在图片删除失败'
                        }
                    }else{
                            die(5);//$picurl.'带http本地图片且服务器不存在的或已经被删除的图片'
                    }
                }else{
                    die(6);//$picurl.'带http外部图片无需删除'
                }
            }else{
                if(unlink('../'.$picurl)){
                    die(7);//$picurl.'不带http本地图片删除成功'
                }else{
                    die(8);//$picurl.'不带http本地图片删除失败'
                } 
            }
        }else{
                die(9);//$picurl.'收到空的url'
        }


    4
    赏礼
    赏钱
    收藏
    点击回复
        全部留言
    • 3
    • 银杏114在线 实战运营者 消费:3609.79元 2021-09-11 18:48 18:486楼
      高手
    0 赏钱 赏礼回复
    • 袁冬 普通粉丝 消费:160.85元 2021-09-09 21:35 21:35
      华为
      6楼
      可以可以
    0 赏钱 赏礼回复
    • Array 消费:15元 2021-09-09 18:48 18:486楼
      都成高手了
    0 赏钱 赏礼回复
    更多回复
        你可能感兴趣的主题
    恢复多功能编辑器
  • 3 1
  • 推荐内容
    扫一扫访问手机版
    请选择要切换的马甲:

     
    网页即时交流
    QQ咨询
    咨询热线
    020-28998648