我有这个文字($ results):
{"data":{"summary":{"records":67,"page":1,"total":67,"hasMore":0},"reservations":[{"id":1111111,"property":"villadianna","from":"2016-07-18","to":"2016-07-25"},"pricing":{"price":1164.2400,"currency":"EUR","retail":1323},"clientInfo":{"firstName":"pera","lastName":"peric","email":"myemail@gmail.com"},"status":1,"offline":0},{"id":222222,"property":"villadianna", etc. ... ...
现在我需要获得reserations数组并进行foreach循环,所以我尝试:
...
$result = curl_exec($ch);
curl_close($ch);
$json = json_decode($result);
foreach ($json->reservations as $element) {
print_r($element);
}
如何使用foreach循环创建仅用于预订的html表?
答案 0 :(得分:1)
...
$result = curl_exec($ch);
curl_close($ch);
$json = json_decode($result);
foreach ($json->data->reservations as $element) {
print_r($element);
}