PHP如何将数据附加到序列化数组中
If I have a serialized array... how can I append more values to it? Should I unserialize it first -> add data and then serialize it again?
解决方案Yes.
function addItem($serializedArray, $item)
{
$a = unserialize($serializedArray);
$a[] = $item;
return serialize($a);
}
相关文章