SORU
2 Mart 2011, ÇARŞAMBA


json_decode diziye

Bir dizi içine bir JSON dize çözmek için çalışıyorum ama aşağıdaki hatayı alıyorum.

Ölümcül hata: nesne türü kullanın dizi olarak stdClass içinde :\Wamp\www\temp\asklaila.php içi sıvı dolu 6

İşte kod:

<?php
$json_string = 'http://www.domain.com/jsondata.json';

$jsondata = file_get_contents($json_string);
$obj = json_decode($jsondata);
print_r($obj['Result']);
?>

CEVAP
2 Mart 2011, ÇARŞAMBA


the documentation başı gibi bir kod olmalı json_decode, bir nesne yerine ilişkilendirilebilir bir dizi istiyorsanız belirtmeniz gerekir:

json_decode($jsondata, true);

Bunu Paylaş:
  • Google+
  • E-Posta
Etiketler:

YORUMLAR

SPONSOR VİDEO

Rastgele Yazarlar

  • incognitotraveler

    incognitotra

    27 Mayıs 2010
  • rekjavicxxx

    rekjavicxxx

    28 EKİM 2007
  • XxMinayaxX1

    XxMinayaxX1

    9 Mayıs 2012