Witaj Gościu! ( Zaloguj | Rejestruj )

Forum PHP.pl

 
Reply to this topicStart new topic
> [PHP] Problem z PHP - Undefined offset 0 i JSON
---Gregor---
post 1.05.2012, 17:26:33
Post #1





Goście







Plik JSON:
[‹"embed_count":"3204","name":"username","s_count":"5900","category":"gaming","format":"live","_count":9538›]

Dostaję w PHP:
Array ( [0] => Array ( [embed_count] => 3216 [name] => username [s_count] => 5900 [category] => gaming [format] => live [_count] => 9538 )

Kod:
$json_file = @file_get_contents("...", 0, null, null);
$json_array = json_decode($json_file, true);
$this->guests= $json_array[0]['_count'];

I uwagach mam:
Undefined offset: 0 in ...

Ktoś mi może to wytłumaczyć?
Go to the top of the page
+Quote Post
wNogachSpisz
post 4.05.2012, 19:15:28
Post #2





Grupa: Zarejestrowani
Postów: 1 233
Pomógł: 87
Dołączył: 6.03.2009

Ostrzeżenie: (40%)
XX---


Jest różnica miedzy jsonem używamy przez javascript a php.
Sprobuj tego: http://pear.php.net/package/Services_JSON
Go to the top of the page
+Quote Post

Reply to this topicStart new topic
1 Użytkowników czyta ten temat (1 Gości i 0 Anonimowych użytkowników)
0 Zarejestrowanych:

 



RSS Wersja Lo-Fi Aktualny czas: 14.08.2025 - 12:40