我有一个数据存储在数组中
$roles = [2,4];
我想将我在 $roles 中的数据与数据库中的数据进行映射。如果我像上面那样在 $roles 中有多个数据,我不知道如何映射数据,而且我不知道如何在表视图中显示所有数据。
我试试这个
if (count($roles) == 1) {
if ($roles[0] == 2) {
$data['need_app'] = $this->Hire_model->need_approval_req($OrganizationID, $requestor_id);
}else if ($roles[0] == 3) {
$data['need_app'] = $this->Hire_model->need_approval_recruiter();
}else if ($roles[0] == 4) {
$data['need_app']=$this->Hire_model->need_approval_hr();
}else if ($roles[0] == 5) {
$data['need_app'] = $this->Hire_model->need_approval_cc($PositionID, $OrganizationID, $requestor_id);
}
}else{
for ($i=0; $i < count($roles)-1 ; $i++) {
if ($roles[0] == 2) {
$data['need_app'] = $this->Hire_model->need_approval_req($OrganizationID, $requestor_id);
var_dump(count($data['need_app']));
}else if ($roles[0] == 3) {
$data['need_app'] = $this->Hire_model->need_approval_recruiter();
}else if ($roles[0] == 4) {
$data['need_app']=$this->Hire_model->need_approval_hr();
}else if ($roles[0] == 5) {
$data['need_app'] = $this->Hire_model->need_approval_cc($PositionID, $OrganizationID, $requestor_id);
var_dump(count($data['need_app']));
}
// var_dump(count($data['need_app']));
}
}
希望有人能帮助我
翻翻过去那场雪
元芳怎么了