我获取图片网址的代码
DefaultHttpClient httpClient = new DefaultHttpClient();
HttpPost httpPost = new HttpPost(url);
httpPost.setEntity(new UrlEncodedFormEntity(params));
HttpResponse httpResponse = httpClient.execute(httpPost);
HttpEntity httpEntity = httpResponse.getEntity();
InputStream inputStream = httpEntity.getContent();
BufferedReader reader = new BufferedReader(new InputStreamReader(inputStream, "iso-8859-1"), 8);
StringBuilder stringBuilder = new StringBuilder();
String line = null;
while ((line = reader.readLine()) != null) {
stringBuilder.append(line + "\n");
}
inputStream.close();
return stringBuilder.toString();
服务器代码在 php 中的位置
但问题是在每个 / 之前都有额外的 \ 例如数据库图像 URL 是,http://www.dvimaytech.com/markphoto/upload/herwadeshirish123@Gmail.com/Pic.jpg
但我每次都得到http:\/\/www.dvimaytech.com\/markphoto\/upload\/herwadeshirish123@Gmail.com\/Pic.jpg
这个问题是否无法解决,那么另一个解决方案(对我来说是最后一个选择)是删除每个 .
但是当我尝试使用url = url.replace("\","");
它时会出现语法错误String literal is not properly closed by a double-quote