PHP 输出json数据 中文乱码问题
作者:
丶HanGH | 来源:发表于
2017-07-06 19:07 被阅读0次<?php
/**
* @ Han
* @date 2017-05-28 14:00:37
* 输出json数据
*/
$conn = mysqli_connect("localhost","root","root","reactnative");
$conn->query("set names 'utf8'");
$sql = "select * from aqidata";
$result = $conn->query($sql);
$arr = array();
while($row = $result->fetch_assoc()) {
$arr=$row;
}
foreach ( $arr as $key => $value ) {
$arr[$key] = urlencode ( $value );
}
echo urldecode(json_encode($arr));
mysqli_close($conn);
?>
本文标题:PHP 输出json数据 中文乱码问题
本文链接:https://www.haomeiwen.com/subject/buhkhxtx.html
网友评论