Php returned json format problem

php


$arr = [
        "errNo" => 0,
        "errstr" => "success",
        "data" => [

                "list" => [],
        ],

Header("Content-type:application/json; charset=UTF-8");
echo json_encode($arr);

other people"s website:

clipboard.png

:

clipboard.png

what is the reason for this?

Php
Mar.07,2022

actually comes from the same thing. As long as it is not the first data to be loaded, there will be a color reminder, such as Ajax data

.

data.php

<?php
$arr = [
        'errNo' => 0,
        'errstr' => 'success',
        'data' => [

                'list' => [],
        ]
];
header('Content-Type:application/json;');
echo json_encode($arr);

Front

<script src="https://unpkg.com/axios/dist/axios.min.js"></script>
<script>
axios.get('/data.php')
  .then(function (response) {
    console.log(response.data);
  });
</script>

result

clipboard.png


need to confirm what the content-type in response header is

MySQL Query : SELECT * FROM `codeshelper`.`v9_news` WHERE status=99 AND catid='6' ORDER BY rand() LIMIT 5
MySQL Error : Disk full (/tmp/#sql-temptable-64f5-1b3dadf-2c3b8.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
MySQL Errno : 1021
Message : Disk full (/tmp/#sql-temptable-64f5-1b3dadf-2c3b8.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
Need Help?