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

  • Eric Magidson

    Eric Magidso

    4 Ocak 2009
  • huyked

    huyked

    28 Mart 2008
  • thegeniuses.tv

    thegeniuses.

    11 Aralık 2006