我的Json值在我的MySQL數據庫列像下面獲取JSON值和正確顯示其元素
{"2":{"label":"","value":"","type":null,"validation":null,"required":null,"min":null,"max":null,"tooltip":null,"custom":null,"custom2":null,"custom3":"zz","custom4":null,"custom5":null},"3":{"label":"location","value":"http:\/\/localhost\/wordpress\/?page_id=320","type":"hidden","validation":"","required":"0","min":"0","max":"1000","tooltip":"","custom":null,"custom2":null,"custom3":"zz","custom4":null,"custom5":null},"4":{"label":"Name","value":"fjedhfjkhre","type":"text","validation":"","required":"0","min":"0","max":"300","tooltip":"field0","custom":"","custom2":null,"custom3":"zz","custom4":null,"custom5":null},"5":{"label":"Email","value":"[email protected]","type":"email","validation":"email","required":"0","min":"","max":"","tooltip":"field1","custom":"","custom2":"","custom3":"zz","custom4":"","custom5":""},"6":{"label":"Files","value":"3","type":"upload","validation":"file","required":"0","min":"","max":"","tooltip":"field2","custom":null,"custom2":null,"custom3":"zz","custom4":null,"custom5":null},"7":{"label":"files","value":"http:\/\/localhost\/wordpress\/wp-content\/plugins\/formcraft\/file-upload\/server\/php\/files\/Desert.jpg","type":"file0","validation":null,"required":null,"min":null,"max":null,"tooltip":null,"custom":null,"custom2":null,"custom3":"zz","custom4":null,"custom5":null},"8":{"label":"files","value":"http:\/\/localhost\/wordpress\/wp-content\/plugins\/formcraft\/file-upload\/server\/php\/files\/Jellyfish.jpg","type":"file1","validation":null,"required":null,"min":null,"max":null,"tooltip":null,"custom":null,"custom2":null,"custom3":"zz","custom4":null,"custom5":null},"9":{"label":"files","value":"http:\/\/localhost\/wordpress\/wp-content\/plugins\/formcraft\/file-upload\/server\/php\/files\/Lighthouse.jpg","type":"file2","validation":null,"required":null,"min":null,"max":null,"tooltip":null,"custom":null,"custom2":null,"custom3":"zz","custom4":null,"custom5":null},"10":{"label":"Comments","value":"hoi this is a cijkmkmkm","type":"para","validation":"","required":"0","min":"0","max":"300","tooltip":"field3","custom":"","custom2":null,"custom3":"zz","custom4":null,"custom5":null},"11":{"label":"Date","value":"01-15-2014","type":"date","validation":"date","required":"0","min":"","max":"","tooltip":"field4","custom":null,"custom2":null,"custom3":"zz","custom4":null,"custom5":null},"12":{"label":"Profession","value":"Option A","type":"radio","validation":"","required":"0","min":"","max":"","tooltip":"field5","custom":null,"custom2":null,"custom3":"zz","custom4":null,"custom5":null},"13":{"label":"title","value":"Form Title","type":null,"validation":null,"required":null,"min":null,"max":null,"tooltip":null,"custom":null,"custom2":null,"custom3":"zz","custom4":null,"custom5":null},"0":{"custom3":"zz","label":"","value":null},"1":{"custom3":"zz","label":"","value":null}}
我想從它那裏得到正確的價值觀,如電子郵件,文件網址....等等。
我正在使用這個。
global $wpdb;
$results = $wpdb->get_results("SELECT * FROM wp_submissions ORDER BY id");
if(!empty($results)) {
foreach($results as $r) {
echo "<p>".$r->content."</p>";
$json_object=$r->content;
}
$arr = json_decode($json_object);
echo echo $arr['0'];
} else {
echo "<p>Boo, we couldn't find anything that is in all these groups. Try removing a category!</p>";
}
當我回聲R->內容它顯示如上述所有的JSON值。但我無法解碼並獲得json數組elemt結果。
這是一個表格數據,所以我想在表格中顯示enteries。
謝謝如果有人幫助我。