boyutlu bir dizideki bir öğe bulmak için nasıl

0 Cevap php

i aşağıdaki sorgu var:

$simplequery = array('type'=>'/travel/travel_destination',
                     'id'=>$_POST["hcity"],
                     'name' => null,
                     'tourist_attractions' => array(
                         array('/common/topic/article'=>array(array('guid'=>null)),
                               '/common/topic/image'=>array(array('guid'=>null))
                         )
                     )
);

$queryarray = array('q1' => array('query' => $simplequery));
$jsonquerystr = json_encode($queryarray);
//echo $jsonquerystr;
#run the query 
$apiendpoint = "http://www.freebase.com/api/service/mqlread?queries";
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, "$apiendpoint=$jsonquerystr");
curl_setopt($ch, CURLOPT_HEADER, 0);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
$jsonresultstr = curl_exec($ch);
curl_close($ch);
$temp = str_replace("#", "", $jsonresultstr);
$resultarray = json_decode($temp, true);

I want to take the guid string of the '/common/topic/image' array. It is a multidimensional array and i can't find out how to do it. I tried writting

$result = $resultarray["q1"]["result"]["tourist_atractions"]['/common/topic/image'];

ama çalışmıyor. Lütfen bana yardım edebilir? teşekkürler

0 Cevap