doutou19761022 2012-12-11 06:49
浏览 31
已采纳

如何解析php中的json输入(yii框架)

I have JSON input as follows:

$json='{"PollQuestion":"Which is biggest country","Isactive":1,"options":[{"option":"abc"},{"option":"xyz"},{"option":"acssr"}]}'
$obj=json_encode($json);

So how to access options fields and individual option? I want to put these options in option table. Please help me in parsing this json input in php (Yii framework).

  • 写回答

3条回答 默认 最新

  • doukong5394 2012-12-11 06:55
    关注
    $json='{"PollQuestion":"Which is biggest country","Isactive":1,"options":[{"option":"abc"},{"option":"xyz"},{"option":"acssr"}]}';
    
    $decode = json_decode($json, true);
    echo $decode['PollQuestion'];
    
    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论
查看更多回答(2条)

报告相同问题?