0

現在、次のものを取得しようとしています

['orders.customerlock'] from the following information

string(3145) "{"recsonpage":"6","6":{"orders.orderid":"x","entity.customerid":"x","entity.entityid":"x","orders.endtime":"x","orders.resellerlock":"false","orders.timestamp":"2012-07-16 18:30:36.76788+00","orders.customerlock":"true","entity.entitytypeid":"3","entity.currentstatus":"Active","entitytype.entitytypekey":"domcno","orders.transferlock":"true","orders.creationtime":"1342463436","entitytype.entitytypename":".COM Domain Name","orders.creationdt":"1342463436","entity.description":"x"},"5":{"orders.orderid":"x","entity.customerid":"x","entity.entityid":"44331779","orders.endtime":"1370362990","orders.resellerlock":"false","orders.timestamp":"2012-06-04 16:23:12.282333+00","orders.customerlock":"true","entity.entitytypeid":"3","entity.currentstatus":"Active","entitytype.entitytypekey":"domcno","orders.transferlock":"true","orders.creationtime":"1338826990","entitytype.entitytypename":".COM Domain Name","orders.creationdt":"1338826990","entity.description":"estavisapplication.com"},"4":{"orders.orderid":"x","entity.customerid":"x","entity.entityid":"44199575","orders.endtime":"1369853889","orders.resellerlock":"false","orders.timestamp":"2012-05-29 18:58:11.219513+00","orders.customerlock":"true","entity.entitytypeid":"3","entity.currentstatus":"Active","entitytype.entitytypekey":"domcno","orders.transferlock":"true","orders.creationtime":"1338317889","entitytype.entitytypename":".COM Domain Name","orders.creationdt":"1338316103","entity.description":"x"},"3":{"orders.orderid":"x","entity.customerid":"x","entity.entityid":"43923731","orders.endtime":"1368676977","orders.resellerlock":"false","orders.timestamp":"2012-06-04 16:47:25.45736+00","orders.customerlock":"true","entity.entitytypeid":"2","entity.currentstatus":"Suspended","entitytype.entitytypekey":"dominfo","orders.transferlock":"true","orders.creationtime":"1337140977","entitytype.entitytypename":".INFO Domain Name","orders.creationdt":"1337140977","entity.description":"x"},"2":{"orders.orderid":"x","entity.customerid":"x","entity.entityid":"43885152","orders.endtime":"1400025600","orders.resellerlock":"false","orders.timestamp":"2012-05-14 18:40:40.744535+00","orders.customerlock":"false","entity.entitytypeid":"64","entity.currentstatus":"Active","entitytype.entitytypekey":"thirdleveldotuk","orders.transferlock":"false","orders.creationtime":"1336953600","entitytype.entitytypename":"ThirdLevel DotUK Domain Name","orders.creationdt":"1337019369","entity.description":"x"},"recsindb":"6","1":{"orders.orderid":"x","entity.customerid":"x","entity.entityid":"x","orders.endtime":"1397779200","orders.resellerlock":"false","orders.timestamp":"2012-04-18 01:31:08.774762+00","orders.customerlock":"false","entity.entitytypeid":"64","entity.currentstatus":"Active","entitytype.entitytypekey":"thirdleveldotuk","orders.transferlock":"false","orders.creationtime":"1334707200","entitytype.entitytypename":"ThirdLevel DotUK Domain Name","orders.creationdt":"1334705745","entity.description":"x"}}"

私たちが抱えている唯一の問題は、使用しようとするときに次のように言うことです:

<? foreach ($json_a as $person_name => $person_a) {
echo $person_a['orders.customerlock'];
echo "<br>";
}

?>

次のように表示されます。

6
true
true
true
true
false
6
false

6 と他の 6 はページの他のフィールドからのものです。foreach がこれらを取得するのを止める方法はありますか

テキストのサイズについてのお詫び

4

2 に答える 2

3

投稿のような文字列の場合$json_aは、関数を使用してこれを php 配列にデコードする必要がありjson_decode()ます。マニュアルの詳細: http://php.net/manual/en/function.json-decode.php

于 2012-07-26T20:12:23.363 に答える
1
$json_a = '{"recsonpage":"6","6":{"orders.orderid":"45034426","entity.customerid":"8557610","entity.entityid":"45034426","orders.endtime":"1373999436","orders.resellerlock":"false","orders.timestamp":"2012-07-16 18:30:36.76788+00","orders.customerlock":"true","entity.entitytypeid":"3","entity.currentstatus":"Active","entitytype.entitytypekey":"domcno","orders.transferlock":"true","orders.creationtime":"1342463436","entitytype.entitytypename":".COM Domain Name","orders.creationdt":"1342463436","entity.description":"jaimeservices.com"},"5":{"orders.orderid":"44331779","entity.customerid":"8392441","entity.entityid":"44331779","orders.endtime":"1370362990","orders.resellerlock":"false","orders.timestamp":"2012-06-04 16:23:12.282333+00","orders.customerlock":"true","entity.entitytypeid":"3","entity.currentstatus":"Active","entitytype.entitytypekey":"domcno","orders.transferlock":"true","orders.creationtime":"1338826990","entitytype.entitytypename":".COM Domain Name","orders.creationdt":"1338826990","entity.description":"estavisapplication.com"},"4":{"orders.orderid":"44199575","entity.customerid":"8371124","entity.entityid":"44199575","orders.endtime":"1369853889","orders.resellerlock":"false","orders.timestamp":"2012-05-29 18:58:11.219513+00","orders.customerlock":"true","entity.entitytypeid":"3","entity.currentstatus":"Active","entitytype.entitytypekey":"domcno","orders.transferlock":"true","orders.creationtime":"1338317889","entitytype.entitytypename":".COM Domain Name","orders.creationdt":"1338316103","entity.description":"listmyhost.com"},"3":{"orders.orderid":"43923731","entity.customerid":"8308173","entity.entityid":"43923731","orders.endtime":"1368676977","orders.resellerlock":"false","orders.timestamp":"2012-06-04 16:47:25.45736+00","orders.customerlock":"true","entity.entitytypeid":"2","entity.currentstatus":"Suspended","entitytype.entitytypekey":"dominfo","orders.transferlock":"true","orders.creationtime":"1337140977","entitytype.entitytypename":".INFO Domain Name","orders.creationdt":"1337140977","entity.description":"wso-shell.info"},"2":{"orders.orderid":"43885152","entity.customerid":"8301781","entity.entityid":"43885152","orders.endtime":"1400025600","orders.resellerlock":"false","orders.timestamp":"2012-05-14 18:40:40.744535+00","orders.customerlock":"false","entity.entitytypeid":"64","entity.currentstatus":"Active","entitytype.entitytypekey":"thirdleveldotuk","orders.transferlock":"false","orders.creationtime":"1336953600","entitytype.entitytypename":"ThirdLevel DotUK Domain Name","orders.creationdt":"1337019369","entity.description":"com-bios.co.uk"},"recsindb":"6","1":{"orders.orderid":"43312036","entity.customerid":"8183814","entity.entityid":"43312036","orders.endtime":"1397779200","orders.resellerlock":"false","orders.timestamp":"2012-04-18 01:31:08.774762+00","orders.customerlock":"false","entity.entitytypeid":"64","entity.currentstatus":"Active","entitytype.entitytypekey":"thirdleveldotuk","orders.transferlock":"false","orders.creationtime":"1334707200","entitytype.entitytypename":"ThirdLevel DotUK Domain Name","orders.creationdt":"1334705745","entity.description":"phsd.co.uk"}}';

$json_a = json_decode($json_a, true);

foreach ($json_a as $person_name => $person_a) {
    if (is_array($person_a)) {
        echo $person_a['orders.customerlock'] . "<br>";
    }
}
于 2012-07-26T20:21:37.450 に答える