2012-11-01 110 views
0
{"hari.com":{"status":"regthroughothers","classkey":"domcno"},"hari.net":{"status":"regthroughothers","classkey":"dotnet"}} 

它顯示我們需要使用PHP來運行循環,並在下面的格式 顯示它就像我們需要使用PHP在HTML形式的TR和TD的標籤顯示,JSON和HTML表單提取JSON數據和HTML表單

像:

Hari.com regthroughothers price 
Hari.net regthroughothers price 

誰能請在表格中顯示,並且還我需要的狀態被打印在單獨的TD和價格在不同的TD.Please幫我就像上面的例子 基礎的在TLD上我想要顯示Outpu噸。

+3

和問題是什麼? – Skpd

+0

你試過了什麼?你的問題很混亂:標題說「形式」,但問題涉及表格元素。 – Barmar

回答

1
<?php 
$json1='{"hari.com":{"status":"regthroughothers","classkey":"domcno"},"hari.net":  {"status":"regthroughothers","classkey":"dotnet"}}'; 

$json1 = json_decode($json1); 

foreach($json1 as $key=>$sel_rows)  
    { 
     echo $key . " " . " welcome " . " price"; 
     echo " status: ". $sel_rows->status; 
     echo "\n";            
    } 
?> 
+0

可以請您在HTML表單中顯示它 – Dinakar

+0

我如何獲得狀態也 – Dinakar

+0

一旦你解析JSON與'json_decode',只需使用普通的關聯數組訪問訪問它,例如任何部件'$ json1 [ 'hari.com'] [ '狀態']'將返回狀態。 – Barmar