我有以下存储在我的数据库中的 json 字符串:
{"Monomeer5e68d7e547620":{"naam":"Monomeer","url":"https:\/\/website.nl\/new\/folie\/monomeer","afbeelding":"assets\/images\/noimg.jpg","aantal":"5","prijs":"2.28","totaalprijs":"20.4","hoogte":"20","breedte":"20","uploaden":"1","specificaties":"Array","controle":"1"},"Elastieken5e68d7e5477b6":{"naam":"Elastieken","url":"https:\/\/website.nl\/new\/folie\/monomeer","afbeelding":"assets\/images\/noimg.jpg","aantal":"1","prijs":"4.50","totaalprijs":"4.5","hoogte":"","breedte":"","uploaden":"0","specificaties":"","controle":""},"Tiewraps5e68d7e5477c8":{"naam":"Tiewraps","url":"https:\/\/website.nl\/new\/folie\/monomeer","afbeelding":"assets\/images\/noimg.jpg","aantal":"1","prijs":"9.95","totaalprijs":"9.95","hoogte":"","breedte":"","uploaden":"0","specificaties":"","controle":""}}
它包含产品信息,否则将由如下所示的会话显示:
Array
(
[Monomeer5eeb62474c5ba] => Array
(
[naam] => Monomeer
[url] => https://website.nl/new/folie/monomeer
[afbeelding] => assets/images/noimg.jpg
[aantal] => 1
[hoogte] => 5
[breedte] => 11
[uploaden] => 1
[specificaties] => Array
(
[Lijmlaag] => Array
(
[waarde] => Wit
)
[Laminaat] => Array
(
[waarde] => Mat laminaat
)
[Afwerking] => Array
(
[waarde] => Contoursnijden
)
)
[prijs] => 0.3355
[totaalprijs] => 0.3355
)
当会话过期时,我希望有人能够再次查找他们的订单信息,所以在显示这个的页面上我试图建立一个检查(查看会话是否存在,如果存在则循环会话,如果不循环在与会话完全相同的 php 数组上)。但是要获得与我的会话相同的数组,它需要从 JSON 字符串转换而来。
我怎样才能做到这一点?将上面的 JSON 字符串转换为与我的 PHP 会话内容看起来相同的 PHP 数组。
冉冉说