To return JSON data, you need to write an interface that only gives a connection and returns JSON data. how can this interface be implemented?
Reply to discussion (solution)
Is the connection output json? What does that mean?
$ Arr = array ('connection successfully'); echo json_encode ($ arr );
This is the simplest thing.
Is the connection output json? What does that mean?
About It
It is to return different data for a connection by concatenating different parameters.
If.
Http: // sxxxxx/json. php? Type = 1
Http: // sxxxxx/json. php? Type = 2
header('Content-type: application/json');$type = isset($_GET['type']) ? intval($_GET['type']) : 1;$array = array();if ($type == 1) { $array = array("test" => "I'm 1");} else if ($type == 2) { $array = array("test" => "I'm 2");}echo json_encode($array);
Http: // sxxxxx/json. php? Type = 1
Http: // sxxxxx/json. php? Type = 2
header('Content-type: application/json');$type = isset($_GET['type']) ? intval($_GET['type']) : 1;$array = array();if ($type == 1) { $array = array("test" => "I'm 1");} else if ($type == 2) { $array = array("test" => "I'm 2");}echo json_encode($array);
++