<?php
require "db.php";
$result = mysqli_query($conn,"select teachers_info.teachers_xm , left (teach.sk_nj,4) as 'fl' FROM teachers_info ,teach WHERE
teachers_jgh = sk_jgh GROUP BY teachers_xm,teach.sk_nj ;
");
$array= array();
class User{
public $teachers_xm;
public $fl;
}
while($row = mysqli_fetch_array($result,MYSQLI_ASSOC)){
$user=new User();
$user->teachers_xm = $row['teachers_xm'];
$user->fl = $row['fl'];
$array[]=$user;
}
header('Content-Type:application/json; charset=utf-8');
$data=json_encode($array,JSON_UNESCAPED_UNICODE);
echo $data;