如何從PHP壓縮JSON並在ASP.NET中解壓縮

[英]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. I am getting Fatal error: Allowed memory size of 67108864 bytes exhausted (tried to allocate 48 bytes)

我在從PHP服務器和ASP.NET服務器傳遞JSON時遇到問題。我收到致命錯誤:允許的內存大小為67108864字節耗盡(試圖分配48個字節)

I am looking for a way to compress the JSON.

我正在尋找一種壓縮JSON的方法。

Thanks

4 个解决方案

#1


0  

Flush the output buffers regularly, so you don't need to have more than a few KB to produce your many MB stream.

定期刷新輸出緩沖區,因此您不需要多於幾KB來生成許多MB流。

#2


1  

Compressing the JSON will probably not change anything, since you'll need the uncompressed JSON before you can compress it (ie. you'll end up using even more memory then you are using currently).

壓縮JSON可能不會改變任何東西,因為在壓縮它之前你需要未壓縮的JSON(即你最終會使用更多的內存然后你正在使用它)。

#3


0  

Why not increase your memory size in your PHP.ini file?

為什么不在PHP.ini文件中增加內存大小?

#4


0  

.NET has built in compression classes. Such as the DeflateStream or GzipStream classes located in the System.IO.Compression namespace. They should do the trick.

.NET內置了壓縮類。例如位於System.IO.Compression命名空間中的DeflateStream或GzipStream類。他們應該做的伎倆。


注意!

本站翻译的文章,版权归属于本站,未经许可禁止转摘,转摘请注明本文地址:https://www.itdaan.com/blog/2010/09/27/72fa5ec6df03e998b037e414e34ed175.html



 
粤ICP备14056181号  © 2014-2021 ITdaan.com