参见英文答案 >
UTF-8 all the way through13个
我有阿拉伯字符的问题,当我做json_encode()它总是返回????,在数据库中所有字段和数据库是utf8
原文链接:https://www.f2er.com/php/135900.html我有阿拉伯字符的问题,当我做json_encode()它总是返回????,在数据库中所有字段和数据库是utf8
我的代码:
$query = MysqL_query("SELECT * FROM `Names`"); if (!$query) { $message = 'Invalid query: ' . MysqL_error() . "\n"; die($message); }else { while ($row = MysqL_fetch_assoc($query)) { $result[] = array( 'Mid' => $row['Mid'],'Uid' => $row['Uid'],'Cid' => $row['Cid'],'Name' => $row['Name'],'city' => $row['city'],'status' => $row['status'],'Mobile' => $row['Mobile'],'Phone' => $row['Phone'],'Email' => $row['Email']); } header('Content-Type: application/json; charset=utf-8'); echo json_encode($result); }
结果如下:
[{"Mid":"17","Uid":"1","Cid":"8","Name":"???? ?? ??????? ?? ???","city":"?????",
请帮我