dongpan1416 2017-02-02 09:37
浏览 38
已采纳

codeigniter形式响应为json

In my codeigniter application I have a form in my views and I want to pass the responses received from this form in json format for further use. Can anyone guide me on steps to do the same please

  • 写回答

1条回答 默认 最新

  • dop82210 2017-02-02 10:08
    关注

    This code might help

     $arr=['name'=>'Ankita','education'=>'Graduate'];
    
     $json=json_encode($arr);
    
     var_dump($json);
    

    The result would be

    string(40) "{"name":"Ankita","education":"Graduate"}"
    
    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论

报告相同问题?