2017-08-01 44 views
0

任何人都知道如何用php读取这些数据?用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:"";}} 
+2

这是一个串行化PHP数组。 '$ hello = unserialize('你问题中的字符串'); var_dump($ hello);' –

+3

在我看来,我们应该对这个问题进行冷静投票。当然,它不包含任何尝试,但如果您不知道该字符串是什么,那么您甚至会开始搜索它? –

回答

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 
+0

这解决了我的问题。感谢您的帮助,我很感激:D。 –