gpt4 book ai didi

php - json_encode utf8

转载 作者:行者123 更新时间:2023-12-04 22:20:22 35 4
gpt4 key购买 nike

我将一些数据放入我的 mysql 数据库中,它运行良好。但是当我使用 json_encode 获取数据时,我会像这样返回:

{"idpostdata":"49","artID":null,"timestamp":"06.11.2012 13:35","lat":"51.496911","lon":"7.4022327","cellID":null,"road":"Wittener Stra\u00dfe","suburb":"Eichlinghofen","city":"Dortmund","postdatacol":null,"state_district":"Regierungsbezirk Arnsberg","state":"North Rhine-Westphalia","country_code":"de"}

您看到 "road":"Wittener Straße" 不是正确的名称,它必须是 Wittener Straße

我的代码:

<?php
$sql = mysql_query("SELECT * FROM postdata");

while ($ds = mysql_fetch_assoc($sql))
$output[]=$ds;
echo "{uTraf:";
print(json_encode($output));
echo "}";
mysql_close($dz);
?>

怎么了?

最佳答案

What is wrong?

没有。 \uxxxx是JSON对UTF-8字符的编码方式。

使用正确的 JSON 解码方法解码 JSON 后,它会再次正常显示。

关于php - json_encode utf8,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/13251689/

35 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com