您好,欢迎来到三六零分类信息网!老站,搜索引擎当天收录,欢迎发信息

APP端压缩上传,与PHP端解压实现

2024/3/30 17:02:18发布11次查看
一、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
该用户其它信息

VIP推荐

免费发布信息,免费发布B2B信息网站平台 - 三六零分类信息网 沪ICP备09012988号-2
企业名录 Product