为了账号安全,请及时绑定邮箱和手机立即绑定

我想根据员工姓名打印负责人的姓名

我想根据员工姓名打印负责人的姓名

PHP
海绵宝宝撒 2021-04-26 21:56:00
我想动态地打印Sumita Nath的Abhishek的头像,但是不显示头像。为什么会这样呢?我用不同的方法尝试了很多次,但是没有显示输出。这是我的数据:   $employee = array(0=>    array("employee_id"=>1, "firstName"=>"Zahir", "lastName"=>"Alam", "Age"=>25, "Company"=>"Switchme", "Role"=>"Developer", "Department"=>"Tech"        ,"Head"=>            array("Id"=>3 , "Name"=>"Sourasis Roy")    ),1=>    array("employee_id"=>2, "firstName"=>"Amith", "lastName"=>"Manniken", "Age"=>25, "Company"=>"Switchme", "Role"=>"Developer", "Department"=>"Tech"        ,"Head"=>            array("Id"=>3 , "Name"=>"Sourasis Roy")    ),2=>    array("employee_id"=>3, "firstName"=>"Sourasis", "lastName"=>"Roy", "Age"=>28, "Company"=>"Switchme", "Role"=>"CTO"),3=>    array("employee_id"=>4, "firstName"=>"Aditya", "lastName"=>"Mishra", "Age"=>29, "Company"=>"Switchme", "Department"=>"Tech", "Role"=>"CEO"),4=>    array("employee_id"=>5, "firstName"=>"Priti", "lastName"=>"Lata", "Age"=>24, "Company"=>"Switchme", "Role"=>"HR"),5=>    array("employee_id"=>6, "firstName"=>"Sumita", "lastName"=>"Nath", "Age"=>24, "Company"=>"Switchme", "Role"=>"HLA Head", "Department"=>"Crm"),6=>    array("employee_id"=>7, "firstName"=>"Tarini", "lastName"=>"Khanna", "Age"=>22, "Company"=>"Switchme", "Role"=>"Content Writer"),7=>    array("employee_id"=>8, "firstName"=>"Abhisek", "lastName"=>"Soni", "Age"=>23, "Company"=>"Switchme", "Role"=>"HLA", "Department"=>"Crm","Head"=>array("Id"=>5 , "Name"=>"Sumita Nath")    )    );这就是我尝试过的:$name="Abhishek";echo "The Head of ";echo $name;echo " is ";$key = array_search($name, array_column($employee, 'Head','Name'));//print $employee[7]["Head"echo array_]["Name"];echo $key;
查看完整描述

1 回答

  • 1 回答
  • 0 关注
  • 127 浏览

添加回答

举报

0/150
提交
取消
意见反馈 帮助中心 APP下载
官方微信