2014-10-03 104 views
-6
array(2) { 
    ["data"]=> array(1) 
    { 
     ["MemberData"]=> array(1) 
     { 
      ["Verified"]=> string(1) "Y" 
     } 
    } 
    ["error"]=> array(2) 
    { 
     ["code"]=> string(0) "" 
     ["text"]=> string(0) "" 
    } 
} 

/我想在PHP頁面打印驗證值/提取JSON數據並打印

+1

沒有任何企圖讀呢? – Ghost 2014-10-03 07:41:52

+1

echo $ array ['data'] ['MemberData'] ['Verified']; ?? – TBI 2014-10-03 08:04:32

回答

0

這是從PHP這樣做是爲了JavaScript的方式:

var ar = JSON.parse('<?php echo json_encode($array) ?>'); 
//ar[1]['MemberData']; //first memberdata value 

console.log(ar[1]['MemberData'].value); 

和從javascript到php你需要使用ajax

jQuery.ajax({ 
    type: "POST", 
    url: 'xxxxxxx', 
    dataType: 'json', 
    data: {array:array, //here you can pass the verified value of the array or the whole array if you want 
     }, 
    success: function(data) { 
      if(data.success == true){ 

      } 
      }, 
    error: function(data) { 
      if(data.success != true){ 

      } 
      }, 
     }); 

然後你可以在PHP端以普通的POST方式讀取它。

Otherway這樣做將符合?驗證=「javascript_array_value」重新載入網址,並用GET

+0

thanxxxx ...但我只想在php中做到這一點.. – 2014-10-03 08:00:08