如何从序列化数组中获取特定值?

时间:2014-02-21 03:12:41

标签: php arrays

我很难挖掘如何获得此序列化数组的特定值:

a:8:{s:13:"store_address";s:0:"";s:14:"country_select";s:2:"PH";s:13:"region_select";s:3:"MLA";s:10:"aboutstore";s:339:"Lorem ipsum dolor sit amet, consectetur adipiscing elit. Sed eleifend turpis at arcu luctus placerat. Duis rhoncus auctor tincidunt. Aenean id nisi tortor, hendrerit sagittis elit. Class aptent taciti sociosqu ad litora torquent per conubia nostra, per inceptos himenaeos. Aliquam nibh massa, consectetur vel ultrices a, rhoncus at lectus.";s:16:"year_established";s:0:"";s:14:"contact_number";s:0:"";s:13:"facebook_page";s:0:"";s:12:"twitter_page";s:0:"";}

例如,我想获得aboutstore值..如何获得此特定值?

1 个答案:

答案 0 :(得分:3)

很简单,你需要unserialize数据,然后你可以作为一个关联数组访问它:

$data = unserialize($your_string_of_serialized_data);

echo $data['aboutstore'];