2012-11-08 27 views
0

嗨,大家好,我正在努力在我的網站上顯示天氣更新。 爲我送一些代碼,在返回我一些東西像下面json轉換

stdClass Object 
(
    [data] => stdClass Object 
     (
      [current_condition] => Array 
       (
        [0] => stdClass Object 
         (
          [temp_C] => 26 
          [temp_F] => 79 
         ) 



       ) 
     ) 
) 

我想取temp_C這是下面的地方[O] => stdClass的對象 爲此我使用的statment像此

//$returning is variable have all the json in it 
$celcius = $returning->data->current_condition->0->temp_c; 

請親切指導我如何獲得temp_C ,,,我目前正在使用php。 Thankx所有

+0

我會讀它親愛的,,但在空閒時間, –

回答

1

current_condition是一個數組

$celcius = $returning->data->current_condition[0]->temp_c; 
+0

thankx親愛@xbonez它的工作對我來說,,,豎起大拇指 –