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

  • EmperorTigerstar

    EmperorTiger

    14 EYLÜL 2009
  • OnlyFunClips

    OnlyFunClips

    16 ŞUBAT 2012
  • Shylo Sharity

    Shylo Sharit

    27 EKİM 2011