我有一组具有不同 userIds 的用户,我正在尝试使用 foreach 循环来循环这些数组。在该循环中,我正在调用一个函数,通过将每个用户的 userid 传递给一个函数来获取每个用户的值。但它只传递一个数组索引。我的代码public function getDailyReportTest($orgId, $date){ $query = $this->db->query("SELECT * FROM `organization_users` WHERE orgId='7'"); $timestamp = strtotime($date); $day = date('l', $timestamp); $data = array();$i = 0;foreach ($query->result_array() as $row) { $data[$i]['date'] = $date; $data[$i]['day'] = $day; $data[$i]['user_id'] = $row['orgUserId']; $data[$i]['user_name'] = $row['orgUserName']; $data[$i]['workingHours'] = self::getUserWorkingHours($data[$i]['user_id'],$date); $delayTime=self::getUserDelayTime($row['orgUserId'],$date); $shortTime=self::getUserShortTime($row['orgUserId'],$date); $overTime=self::getUserOverTime($row['orgUserId'],$date); $data[$i]['delayTime'] =$delayTime; $data[$i]['shortTime'] =$shortTime; $data[$i]['overTime'] =$overTime; $data[$i]['shift1_start'] = self::getUserShiftStartTime($row['orgUserId'], $date); $i=$i+1;}//return $data;print_r($data);die();}public function getUserShiftStartTime($userId, $date){ $query = $this->db->query("SELECT * FROM `office_employee_assigned_shifts` WHERE employeeId='$userId' &&shiftdate='$date'"); $entry = $query->num_rows(); $data = $query->result_array(); if($entry==0) { return NULL; }它只传递 $data[1]['user_id']。我想将 $data[0]['user_id'], $data[1]['user_id'], $data[2]['user_id'] 传递给名为 getUserShiftStartTime($userId, $date) 的函数有帮助吗?我在这里先向您的帮助表示感谢
- 1 回答
- 0 关注
- 137 浏览
添加回答
举报
0/150
提交
取消