2017-04-18 102 views
-1

如何在json數組中回顯表和數據? 我這裏有 enter image description here如何在json數組中回顯表和數據?

$return_arr = array(); 
$row_array['itemnol']= "[SUKSES] Data Berhasil Ditambahkan"; 

$row_array['itemsatu']= //i want displaysome data here from my query with table forma"; 
array_push($return_arr, $row_array); 

echo json_encode($return_arr,true); 

問題,我不會寫HTML表在我的代碼。

任何幫助表示讚賞。

+0

而不是屏幕截圖,更新您的帖子中的代碼。 –

回答

0

您可以通過兩種方式來完成:

第一:

  1. 使用Base64編碼的HTML字符串
  2. JSON編碼

    $html = "Random HTML String"; //Use addslashes if problem creating string 
    $encoded_html = json_encode(base64_encode($html)); 
    

當Retriving回

  • JSON解碼
  • BASE64解碼

    $ decoded_html = BASE64_DECODE(json_decode($ encoded_html));

  • 二:

    只是鍵值對會工作。

    {"htmlstring" => "Some html string"} //use addslashes if issue creating string. 
    
    相關問題