如何用php输出这个json {},{}?

I was unable to output this:

[{"title":"London","foo":"bar"},{"title":"Istanbul","foo":"bar"}]

I cannot make comma here: },{

I can output this [{"title":"London","foo":"bar"}] but not the first example.

This will produce the desired output:

$data = array(
    array("title" => "London",
          "foo" => "bar"
    ), 
    array("title" => "Istanbul",
          "foo" => "bar"
    )
);

echo json_encode($data);

Make sure you create your arrays correctly. For more information have a look at the documentation for json_decode.