Wordpress数据库字符串到数组


Wordpress DB string to array

我正在从Wordpress DB中获取一个字符串,看起来像这样:

a:21:{s:18:"openhours_Sun_text";s:17:"String1";s:19:"openhours_Sun_start";s:4:"9:00";s:17:"openhours_Sun_end";s:5:"22:00"; s:18:"openhours_Mon_text";s:13:"String2";s:19:"openhours_Mon_start";s:4:"9:00";s:17:"openhours_Mon_end";s:5:"22:00"; s:18:"openhours_Tue_text";s:17:"String3";s:19:"openhours_Tue_start";s:4:"9:00";s:17:"openhours_Tue_end";s:5:"22:00"; s:18:"openhours_Wed_text";s:17:"String4";s:19:"openhours_Wed_start";s:4:"9:00";s:17:"openhours_Wed_end";s:5:"22:00"; s:18:"openhours_Thu_text";s:8:"String5";s:19:"openhours_Thu_start";s:4:"9:00";s:17:"openhours_Thu_end";s:5:"22:00"; s:18:"openhours_Fri_text";s:6:"String6";s:19:"openhours_Fri_start";s:4:"9:00";s:17:"openhours_Fri_end";s:5:"16:00"; s:18:"openhours_Sat_text";s:8:"String7";s:19:"openhours_Sat_start";s:5:"19:00";s:17:"openhours_Sat_end";s:5:"23:00";}

我怎么能转移到数组在php?

可以使用maybe_unserialize函数将数据转换为数组

见本典