目前我有一个while循环:
while($row_hours = $getHours->fetch_assoc()) {
$hours[] = $row_hours;
}
输出结果为:
Array
(
[0] => Array
(
[day] => Mon
[open] => 09:00:00
[close] => 17:00:00
[closed] => 0
)
[1] => Array
(
[day] => Tue
[open] => 09:00:00
[close] => 17:00:00
[closed] => 0
)
我想将day键移动为子数组的名称。所以输出看起来像这样:
Array
(
[Mon] => Array
(
[open] => 09:00:00
[close] => 17:00:00
[closed] => 0
)
[Tue] => Array
(
[open] => 09:00:00
[close] => 17:00:00
[closed] => 0
)
这一切都可能吗?我已经尝试了所有我能想到的东西,但我得到了一个错误,或者只是给了我数字。
非常感谢任何人的帮助或建议。