$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::unserialize
2024-11-15
(PHP 5 >= 5.4.0, PHP 7, PHP 8)
SplDoublyLinkedList::unserialize — Unserializes the storage
$data
): voidUnserializes the storage, from SplDoublyLinkedList::serialize().
本函数还未编写文档,仅有参数列表。
data
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.unserialize.php