我已将 Mysql 数据库中的数据格式化如下:
[start]
do this
[working]
do that
and thad
not this
[end]
do this
and this
我使用这个 PHP 脚本获取数据:
$result = mysqli_query($conn, "SELECT * FROM ....");
$data = array();
while($row = mysqli_fetch_assoc($result))
{
$data[] = $row;
}
echo json_encode($data);
然后我在前端显示它:
json[0].columnName
我得到的是:
[start] do this [working] do that and thad not this [end] do this and this
我认为由于使用 json 格式丢失。是否可以将数据库中的格式保留到前端?谢谢
牛魔王的故事