阿拉伯语在将其打印为JSON时未显示

时间:2016-08-26 11:35:03

标签: php json

我的应用程序的PHP端存在问题。 在phpmyAdmin中正确显示阿拉伯语单词,但是当我发出POST请求时,我得到了这个回复:

[{"sno":"1","post_author":"authoromar","post_title":"titleomar","post_body":"bodyomar","post_breaking":"breaking omar","created_at":"0000-00-00 00:00:00","photo_url":"","photo_title":""},{"sno":"2","post_author":"authorrrrrrr","post_title":"titllllll","post_body":"bodyyyyyyyy","post_breaking":"breakinggggggg","created_at":"2016-08-10 12:22:47","photo_url":"","photo_title":""},{"sno":"3","post_author":"\u0639\u0645\u0631","post_title":"\u0627\u0644\u0639\u0646\u0648\u0627\u0646 \u0627\u0644\u0631\u0626\u064a\u0633\u064a","post_body":"\u0645\u062d\u062a\u0648\u0649 \u0627\u0644\u062e\u0628\u0631","post_breaking":"\u0639\u0627\u062c\u0644 \u0639\u0627\u0627\u0627\u0627\u0627\u0627\u0627\u0627\u0627\u0627\u062c\u0644","created_at":"2016-08-15 16:41:29","photo_url":"http:\/\/hjhjhjhjh","photo_title":"\u0639\u0646\u0648\u0627\u0646 \u0627\u0644\u0635\u0648\u0631\u0629"},{"sno":"4","post_author":"\u062a\u0627\u062a\u0644\u0627\u062a\u0644\u0627\u062a\u0628\u0644\u0627\u0628\u0644\u0627\u0628\u0644\u0628\u0644\u0628\u0644","post_title":"\u0627\u062a\u0644\u0627\u062a\u0644\u062a\u0627\u0644\u0627\u062a\u0644\u0627\u062a\u062a\u0644\u0627\u0644\u0644\u062a\u062a\u0644","post_body":"\u0644\u0627\u0628\u0644\u0627\u0628\u0644\u0627\u0628\u0644\u0628\u0628\u0627\u0628\u0644\u0627\u0644\u0628","post_breaking":"\u062b\u0641\u0642\u062b\u0641\u0642\u062b\u0641\u0642\u062b\u0642\u062b\u0642\u062b","created_at":"2016-08-15 16:58:08","photo_url":"khjhjkhj","photo_title":"fgfhgfhffhfh"},{"sno":"5","post_author":"\u0633\u064a\u0634\u064a\u0634\u0633\u0634\u064a\u064a\u0633\u0634\u0633\u064a\u0634\u064a","post_title":"\u0634\u064a\u0633\u0634\u064a\u0633\u0634\u0633\u0634\u064a\u0633","post_body":"\u0628\u0633\u0628\u0633\u0644\u0644\u0644\u0627\u0627\u0633\u0627\u0633","post_breaking":"\u062a\u062a\u0627\u0627\u062a\u0627\u0644\u0628\u0644\u0628\u0644\u0628\u0644\u0628","created_at":"2016-08-15 17:05:19","photo_url":"llkjkjjkljkkjkjkjkj","photo_title":"rsdsdsddsffsdsdf"},{"sno":"6","post_author":"\u0645\u0643\u0646\u0645\u0643\u0646\u0645\u0646\u062a\u0645\u062a\u0646\u0645\u0646\u062a","post_title":"\u062d\u062e\u0633\u062b\u062d\u0647\u062e\u0644\u0641\u062a\u062b\u0633\u0647\u0641\u062a\u0639","post_body":"\u0645\u062b\u0635\u062a\u0641\u0645\u0646\u062b\u0635\u062a\u0645\u0627\u062a","post_breaking":"\u064a\u062a\u0633\u0644\u0645\u0646\u062a\u0633\u064a\u0644","created_at":"2016-08-15 17:26:26","photo_url":"\u0643\u0628\u064a\u0627\u0646\u0629\u0645\u0643\u064a\u0628\u0646\u0627\u0643\u0645\u0628\u064a\u0646","photo_title":"\u0643\u0646\u062d\u062e\u0628\u0647\u0642\u0647\u063a\u062e\u062d\u0647\u062b\u063a"}]

这是我的PHP文件:

<?php
header("Content-Type:application/json;charset=utf-8");
$mysql_db_hostname = "127.0.0.1";
$mysql_db_user = "root";
$mysql_db_password = "";
$mysql_db_database = "testdb";

$con = @mysqli_connect($mysql_db_hostname, $mysql_db_user, $mysql_db_password,
 $mysql_db_database);
$con->set_charset("utf8");
//$con->query("SET collation_connection = utf8_unicode_ci");
if (!$con) {
 trigger_error('Could not connect to MySQL: ' . mysqli_connect_error());
}
$var = array();
$sql = "SELECT * FROM posts";
$result = mysqli_query($con, $sql);

while($obj = mysqli_fetch_object($result)) {
$var[] = $obj;
}
print json_encode($var);
?>

我想要的是显示阿拉伯语单词,如بسمالله而不是\ u064a \ u0633 \ u0633 \ u0633 \ u064a \

0 个答案:

没有答案