我有这个数组,但是我不知道如何动态填充
我的代码:
for ($j = 1; $j <= $weeks; $j++)
{
for ($i = 1; $i <= 7; $i++)
{
$turn_data = $request->input('turn_'.$i.'_'.$j);
if(isset($turn_data))
{
$turn_data = explode("_", $turn_data);
$turn = Turn::find($turn_data[0]);
if($day < 10)
{
$day = "0".$day;
}
$data = array("apiKey" => "85526dd10b9aa01ae6e56698b848d191",
"turnos" => [["codigo" => $rut,
"nombreTurno" => $turn->name,
"fechaInicio" => $year."-".$month_detail_number."-".$day." 00:00:00",
"fechaTermino" => $year."-".$month_detail_number."-".$day." 23:59:59"]]);
}
$day = $day + 1;
}
}
如何放置阵列?问题是turnos也是一个数组,那是我的问题
我需要这样的输出:
Array ( [apiKey] => 85526dd10b9aa01ae6e56698b848d191 [turnos] => Array ( [0] => Array ( [codigo] => 15918421 [nombreTurno] => 6x1 FT/ 08:30 a 16:00 [fechaInicio] => 2019-12-13 00:00:00 [fechaTermino] => 2019-12-13 23:59:59 ) ) )
谢谢!