serialize a large array in PHP?

前端 未结 13 1933
死守一世寂寞
死守一世寂寞 2021-01-04 06:11

I am curious, is there a size limit on serialize in PHP. Would it be possible to serialize an array with 5,000 keys and values so it can be stored into a cache?

I am

13条回答
  •  伪装坚强ぢ
    2021-01-04 06:28

    I've just come across an instance where I thought I was hitting an upper limit of serialisation.

    I'm persisting serialised objects to a database using a mysql TEXT field.

    The limit of the available characters for a single-byte characters is 65,535 so whilst I can serialize much larger objects than that with PHP It's impossible to unserialize them as they are truncated by the limit of the TEXT field.

提交回复
热议问题