我需要 json 数组中的数组键是整数。现在它们是字符串。你能告诉我我的错误在哪里吗?
$i = 0;
while($i < 7) {
isset($ips[date('d', $week_start + $i * 86400)])
? $ips[(int)date('d', $week_start + $i * 86400)] = count(date('d', $week_start + $i * 86400))
: $ips[(int)date('d', $week_start + $i * 86400)] = 0;
isset($time[date('d', $week_start + $i * 86400)])
? $time[(int)date('d', $week_start + $i * 86400)] = count(date('d', $week_start + $i * 86400))
: $time[(int)date('d', $week_start + $i * 86400)] = 0;
$i++;
}
return json_encode(array('unique' => $time, 'impressions' => $ips));