php decode JSON hakkında soru

0 Cevap php

I still have some question about php decode JSON. the JSON return like this.

all({"Total":30,"Debug":null,"Documents":[
{
  "DocTitle":"Image: A municipal police officer takes positio",
  "Docmultimedia":[
        {
          "DocExpire":"2/7/2011 1:39:02 PM"
        }
      ]
    }
 ...]
});

Bu benim php kodu:

foreach ($data->Documents as $result) { 
    echo htmlspecialchars($result->DocTitle).'<br />';
    if(!empty($result->Docmultimedia)){
        echo htmlspecialchars($result->Docmultimedia->DocExpire).'<br />';
    }
}

It return Warning: Invalid argument supplied for foreach(). and echo htmlspecialchars($result->Docmultimedia->DocExpire), is it write right? Thanks all.

0 Cevap