[英]How to compress JSON from PHP and decompress in ASP.NET
I am having a problem passing JSON from PHP server and ASP.NET server. 我在从PHP服务器和ASP.NET服务器传递JSON时遇到问题。 I am getting Fatal error: Allowed memory size of 67108864 bytes exhausted (tried to allocate 48 bytes)
我收到致命错误:允许的内存大小为67108864字节已用尽(尝试分配48个字节)
I am looking for a way to compress the JSON. 我正在寻找一种压缩JSON的方法。
Thanks 谢谢
压缩JSON可能不会改变任何事情,因为在压缩JSON之前,您需要未压缩的JSON(即,最终将使用比当前使用的更多的内存)。
为什么不增加PHP.ini文件中的内存大小?
.NET has built in compression classes. .NET内置了压缩类。 Such as the DeflateStream or GzipStream classes located in the System.IO.Compression namespace.
例如位于System.IO.Compression命名空间中的DeflateStream或GzipStream类。 They should do the trick.
他们应该做到这一点。
定期刷新输出缓冲区,因此您不需要多于几个KB即可生成许多MB流。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.