app 上传 php,APP端压缩上传,与PHP端解压实现
发布日期:2021-06-24 17:42:12 浏览次数:2 分类:技术文章

本文共 670 字,大约阅读时间需要 2 分钟。

一、android与php的交互

java

String body = "Lorem ipsum shizzle ma nizle"; URL url = new URL("http://some.url/file.php?id=" + uid); URLConnection conn = url.openConnection(); conn.setDoOutput(true); conn.setRequestProperty("Content-encoding", "deflate"); conn.setRequestProperty("Content-type", "application/octet-stream"); DeflaterOutputStream dos = new DeflaterOutputStream(conn.getOutputStream()); dos.write(body.getBytes()); dos.flush(); dos.close();

php

$content = http_get_request_body();$uncontent = gzuncompress($content);

二、ios与php的交互

php接收gzip压缩

gzdecode(base64_decode($json));//ios gzip uncompress

php接收zlib压缩

gzuncompress(base64_decode($json));//ios zlib uncompress

转载地址:https://blog.csdn.net/weixin_34190683/article/details/115637689 如侵犯您的版权,请留言回复原文章的地址,我们会给您删除此文章,给您带来不便请您谅解!

上一篇:java使用visio画类图,【什么是类图使用类图的方法】使用visio画类图
下一篇:php文件怎么转换txt文件,php – 解析txt文件并将它们转换为静态html文件

发表评论

最新留言

关注你微信了!
[***.104.42.241]2024年04月10日 06时10分02秒