handling json in php code example
Example 1: how to receive json data in php
$data = json_decode(file_get_contents('php://input'), true);
print_r($data);
echo $data;
Example 2: parse json phph
echo json_decode("[1,2,3]")[0];
Example 3: return json in php
//code igniter
$query="qry";
$query = $this->db->query($query);
$res=$query->result();
return json_encode($res);