mysql - PHP generate JSON code -


this question has answer here:

model json: https://dl.dropboxusercontent.com/s/vjq9j5gwkbrly3y/data.json

how can generate above json using php, including separate categories in above model?

i need separate above categories json. have several selects?

just build arrays,

    $array = array("restaurants"=>array(       array("id"=>23,"name"=>"test","example"=>"ex"),       array("id"=>23,"name"=>"test","example"=>"ex"),       array("id"=>23,"name"=>"test","example"=>"ex")      ),     "categories"=>array(       array("cat"=>"example","ex"=>"example"),       array("cat"=>"example","ex"=>"example")      )      ); 

then use json_encode

    echo json_encode($array); 

example


Comments

Popular posts from this blog

javascript - RequestAnimationFrame not working when exiting fullscreen switching space on Safari -

Python ctypes access violation with const pointer arguments -