query($sql); if($result){ $code = 0; $info = 'success'; $massge = '成功'; }else{ $code = -1; $info = 'fail'; $massge = '失败'; } $json['code'] = $code; $json['info'] = $info; $json['massge'] = $massge; //print_r($json); echo json_encode($json); ?>