var pic = document.getElementById("pic"); var ppp = pic.getAttribute("src");//获取路径属性 var src = encodeURIComponent(ppp);//编码路径传过去之后再进行解码$pic = urldecode($_POST["pic"]); //解码