I use pako.deflate
to compress data in javascript, like this:
js file:
const params = [{id: 5, name: '张三', list: [{code: '10010', type: 'media'}]},{id: 6, name: '李四', list: [{code: '20010', type: 'site'}]}]
let binaryString = pako.deflate(JSON.stringify(params), { to: 'string' })
http.post({data: binaryString})...
and in the web server, I need to decompress that data using PHP.
This is what I do
php file:
$data = $params['data']; // got the right post data
$res = gzinflate(base64_decode($data));
echo $res; //echo false
but $res
echo false
What am I missing?