basic JSON pulling data help
New to json data and struggling i guess the answer is real easy but been bugging me for the last hour..
Sample data
    {
   "data": 
      {
         "userid": "17",
         "dates": {
            "timestame": "1275528578",
                  },
         "username": "harino54",
      }
}
Ok I can pull userid 开发者_如何转开发or username easy enough with
echo "$t->userid" or echo "$t->username "
but how do I pull data from the brackets within ? in this case timestame?
cant seem to figure it out..
any ideas?
It sounds like you are looking for something like this: echo "{$t->dates->timestame}";.
To access data from an object within quotes, you need to surround it with braces.
alternately, you could just say: echo $t->date->timestame; without the quotes.
Are you doing someting like this?
$t = json_decode($jsonString);
echo $t->data->dates->timestame;
or
$t = json_decode($jsonString);
echo "{$t->data->dates->timestame}";
$t -> dates -> timestame
 
         加载中,请稍侯......
 加载中,请稍侯......
      
精彩评论