任何人都知道如何用PHP读取这些数据?
a:5:{i:0;a:2:{s:4:"name";s:25:"1 whole fish, skin intact";s:4:"note";s:0:"";}i:1;a:2:{s:4:"name";s:22:"4 1/2 cups kosher salt";s:4:"note";s:0:"";}i:2;a:2:{s:4:"name";s:14:"3-4 egg whites";s:4:"note";s:0:"";}i:3;a:2:{s:4:"name";s:13:"1/4 cup water";s:4:"note";s:0:"";}i:4;a:2:{s:4:"name";s:105:"aromatics of your choice (garlic cloves, lemon wedges, bay leaves, shallots, sprigs of thyme and parsely)";s:4:"note";s:0:"";}}
答案 0 :(得分:2)
使用unserialize
将此序列化数组转换回数组。
示例:
$serialized = 'a:5:{i:0;a:2:{s:4:"name";s:25:"1 whole fish, skin intact";s:4:"note";s:0:"";}i:1;a:2:{s:4:"name";s:22:"4 1/2 cups kosher salt";s:4:"note";s:0:"";}i:2;a:2:{s:4:"name";s:14:"3-4 egg whites";s:4:"note";s:0:"";}i:3;a:2:{s:4:"name";s:13:"1/4 cup water";s:4:"note";s:0:"";}i:4;a:2:{s:4:"name";s:105:"aromatics of your choice (garlic cloves, lemon wedges, bay leaves, shallots, sprigs of thyme and parsely)";s:4:"note";s:0:"";}}';
var_dump(unserialize($serialized)); // array