0
我有一個WordPress郵寄元到MySql像轉換WordPress郵寄元到PHP數組
[{"field":"Email:1","title":"email","explanation_text":"","explanation_text_location":"","html_styling":"","text_to_display":"","show_title_field":"","pdf_file":"","pdf_file_button_styling":"","pdf_file_button_text":""}]
我需要將其轉換爲PHP
陣列。我使用下面的代碼來使它成爲一個數組。
$wpaf_field_title = maybe_unserialize(get_post_meta(52, '__wpaf_field_title', true));
print_r(json_encode($wpaf_field_title));
但它返回我
"[{\"field\":\"Email:1\",\"title\":\"email\",\"explanation_text\":\"\",\"explanation_text_location\":\"\",\"html_styling\":\"\",\"text_to_display\":\"\",\"show_title_field\":\"\",\"pdf_file\":\"\",\"pdf_file_button_styling\":\"\",\"pdf_file_button_text\":\"\"}]"
使用json_decode代替json_encode – vel
@ user3384 985數據不是它的'json_encode'序列化類型,你需要使用'json_decode'。 – Noman