How to Decode Json object in laravel and apply foreach loop on that in laravel

前端 未结 2 1824
我在风中等你
我在风中等你 2020-12-28 17:57

i am getting this request.   

 { \"area\": [
        {
            \"area\": \"kothrud\"
        },
        {
            \"area\": \"katraj\"
        }
             


        
2条回答
  •  余生分开走
    2020-12-28 18:16

    you can use json_decode function

    foreach (json_decode($response) as $area)
    {
     print_r($area); // this is your area from json response
    }
    

    See this fiddle

提交回复
热议问题