mysql - PHP generate JSON code -
this question has answer here:
- how generate json using php? 4 answers
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);
Comments
Post a Comment