JSON can't returning cyrillic data
问题 $connect = mysqli_connect("localhost", "root", "123456", "json_test"); $sql = "SELECT * FROM names"; $query = mysqli_query( $connect,$sql ); while( $row=mysqli_fetch_array($query) ){ $arr[]=array( 'id' => $row['id'], 'title' => $row['name'] ); } echo json_encode( $arr ); is returning ??????? and it's cyrillic text(utf-8). How to fix it? 回答1: The mysqli_set_charset() function specifies the default character set to be used when sending data from and to the database server. You need to add