$a = new SplDoublyLinkedList;
$arr=[1,2,3,4,5,6,7,8,9];
for($i=0;$i<count($arr);$i++){
$a->add($i,$arr[$i]);
}
$serialize=serialize($a);
echo $serialize;
echo PHP_EOL,PHP_EOL;
$unserialze=unserialize($serialize);
print_r($unserialze);
PHP - Manual: SplDoublyLinkedList::serialize
2024-11-23
(PHP 5 >= 5.4.0, PHP 7, PHP 8)
SplDoublyLinkedList::serialize — Serializes the storage
Serializes the storage.
本函数还未编写文档,仅有参数列表。
此函数没有参数。
The serialized string.
$a = new SplDoublyLinkedList;
$arr=[1,2,3,4,5,6,7,8,9];
for($i=0;$i<count($arr);$i++){
$a->add($i,$arr[$i]);
}
$serialize=serialize($a);
echo $serialize;
echo PHP_EOL,PHP_EOL;
$unserialze=unserialize($serialize);
print_r($unserialze);
官方地址:https://www.php.net/manual/en/spldoublylinkedlist.serialize.php