提取Json数据并以HTML表单显示

时间:2012-11-01 07:48:04

标签: php html json

{"hari.com":{"status":"regthroughothers","classkey":"domcno"},"hari.net":{"status":"regthroughothers","classkey":"dotnet"}}

我们需要使用php运行循环并以下面的格式显示它 就像我们需要使用PHP,JSON和HTML格式在HTMl表单中的TR和TD标签中显示

像:

Hari.com    regthroughothers    price  
Hari.net    regthroughothers    price

任何人都可以在表格中显示,我还需要在单独的TD上打印状态和单独TD上的价格。请像上面的示例一样帮我 基于TLD,我想显示输出。

1 个答案:

答案 0 :(得分: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";                                             
  }
?>