$val){?>

=$val['id']?>οnclick="task(=$val['id']?>,'=$val['name']?>')">=Util::msubstr($val['name'],0,16,'gbk')?>=date("Y-m-d ",strtotime($val['date_start']))?>=$val['plan_director_name']?>

=$v['id']?>=Util::msubstr($val['name'],0,16,'gbk')?>=1?>=date("Y-m-d ",strtotime($v['date_start']))?>=$val['plan_director_name']?>=$v['status']?>}}}}?>

回复讨论(解决方案)

三维数组需要三个foreach嵌套遍历才可以。

但是我第一个父节点下的子节点能遍历出来啊

不是特别清楚你的数据结构,检查一下这个条件有没有满足

if(is_array($val[$key]))

你的外层循环是

foreach($monitorList as $key=>$val)

进入内层循环的条件是

if(is_array($val[$key]))

不符合条件时,自然就没有输出

你至少应

var_export($monitorList);

贴出结果看看

0 => array ( 'id' => '6166', 'create_uid' => '1000', 'create_date' => '2015-01-30 09:48:10.000', 'write_uid' => '1000', 'write_date' => '2015-01-30 09:48:10.000', 'name' => 'C#高级编程', 'plan_type' => '102', 'parent_id' => '0', 'date_start' => '2015-01-30 00:00:00.000', 'date_stop' => '2015-01-30 00:00:00.000', 'product_id' => '2', 'product_qty' => '1', 'plan_director' => '', 'status' => '2', 'routing_id' => '2049', 'bom_id' => '1', 'oe_production_id' => '0', 'note' => '', 'curr_id' => NULL, 'oe_ean13' => '9002', 'workcenter_id' => NULL, 'ischild' => 1, 'plan_director_name' => '', 0 => array ( 0 => array ( 'id' => '6167', 'create_uid' => '1000', 'create_date' => '2015-01-30 09:48:11.000', 'write_uid' => '1000', 'write_date' => '2015-01-30 09:48:11.000', 'name' => 'C#高级编程_xyd工艺组1', 'plan_type' => '102', 'parent_id' => '6166', 'date_start' => '2015-01-30 00:00:00.000', 'date_stop' => '2015-01-30 00:00:00.000', 'product_id' => '2', 'product_qty' => NULL, 'plan_director' => '', 'status' => '1', 'routing_id' => '1', 'bom_id' => NULL, 'oe_production_id' => NULL, 'note' => 'oo', 'curr_id' => NULL, 'oe_ean13' => NULL, 'workcenter_id' => NULL, ), 1 => array ( 'id' => '6168', 'create_uid' => '1000', 'create_date' => '2015-01-30 09:49:20.000', 'write_uid' => '1000', 'write_date' => '2015-01-30 09:49:20.000', 'name' => 'C#高级编程_xyd工艺组2', 'plan_type' => '102', 'parent_id' => '6166', 'date_start' => '2015-01-30 00:00:00.000', 'date_stop' => '2015-01-30 00:00:00.000', 'product_id' => '2', 'product_qty' => NULL, 'plan_director' => '', 'status' => '1', 'routing_id' => '2', 'bom_id' => NULL, 'oe_production_id' => NULL, 'note' => 'pp', 'curr_id' => NULL, 'oe_ean13' => NULL, 'workcenter_id' => NULL, ), ), ), 1 => array ( 'id' => '6189', 'create_uid' => '1000', 'create_date' => '2015-01-30 14:45:00.000', 'write_uid' => '1000', 'write_date' => '2015-01-30 14:45:00.000', 'name' => 'Java高级编程', 'plan_type' => '102', 'parent_id' => '0', 'date_start' => '2015-01-30 00:00:00.000', 'date_stop' => '2015-01-30 00:00:00.000', 'product_id' => '6', 'product_qty' => '1', 'plan_director' => '', 'status' => '1', 'routing_id' => '2045', 'bom_id' => '6', 'oe_production_id' => '0', 'note' => '', 'curr_id' => NULL, 'oe_ean13' => '9002', 'workcenter_id' => NULL, 'ischild' => 1, 'plan_director_name' => '', 0 => array ( 0 => array ( 'id' => '6190', 'create_uid' => '1000', 'create_date' => '2015-01-30 14:45:00.000', 'write_uid' => '1000', 'write_date' => '2015-01-30 14:45:00.000', 'name' => 'Java高级编程_Java高级编程-次包-工序包1', 'plan_type' => '102', 'parent_id' => '6189', 'date_start' => '2015-01-30 00:00:00.000', 'date_stop' => '2015-01-30 00:00:00.000', 'product_id' => '6', 'product_qty' => NULL, 'plan_director' => '', 'status' => '4', 'routing_id' => '8', 'bom_id' => NULL, 'oe_production_id' => NULL, 'note' => '', 'curr_id' => '3032', 'oe_ean13' => NULL, 'workcenter_id' => NULL, ), ), ), 2 => array ( 'id' => '6191', 'create_uid' => '1000', 'create_date' => '2015-01-30 14:48:38.000', 'write_uid' => '1000', 'write_date' => '2015-01-30 14:48:38.000', 'name' => 'Java高级编程', 'plan_type' => '102', 'parent_id' => '0', 'date_start' => '2015-01-30 00:00:00.000', 'date_stop' => '2015-01-30 00:00:00.000', 'product_id' => '6', 'product_qty' => '1', 'plan_director' => '', 'status' => '1', 'routing_id' => '2045', 'bom_id' => '6', 'oe_production_id' => '0', 'note' => '', 'curr_id' => NULL, 'oe_ean13' => '9002', 'workcenter_id' => NULL, 'ischild' => 1, 'plan_director_name' => '', 0 => array ( 0 => array ( 'id' => '6192', 'create_uid' => '1000', 'create_date' => '2015-01-30 14:48:38.000', 'write_uid' => '1000', 'write_date' => '2015-01-30 14:48:38.000', 'name' => 'Java高级编程_Java高级编程-主包-工序包1', 'plan_type' => '102', 'parent_id' => '6191', 'date_start' => '2015-01-30 00:00:00.000', 'date_stop' => '2015-01-30 00:00:00.000', 'product_id' => '6', 'product_qty' => NULL, 'plan_director' => '', 'status' => '8', 'routing_id' => '7', 'bom_id' => NULL, 'oe_production_id' => NULL, 'note' => '', 'curr_id' => NULL, 'oe_ean13' => NULL, 'workcenter_id' => NULL, ), ), ), 3 => array ( 'id' => '6193', 'create_uid' => '1000', 'create_date' => '2015-01-30 14:51:45.000', 'write_uid' => '1000', 'write_date' => '2015-01-30 14:51:45.000', 'name' => 'C#高级编程', 'plan_type' => '102', 'parent_id' => '0', 'date_start' => '2015-01-30 00:00:00.000', 'date_stop' => '2015-01-30 00:00:00.000', 'product_id' => '2', 'product_qty' => '1', 'plan_director' => '', 'status' => '1', 'routing_id' => '2043', 'bom_id' => '1', 'oe_production_id' => '0', 'note' => '', 'curr_id' => NULL, 'oe_ean13' => '9002', 'workcenter_id' => NULL, 'ischild' => 1, 'plan_director_name' => '', 0 => array ( 0 => array ( 'id' => '6194', 'create_uid' => '1000', 'create_date' => '2015-01-30 14:51:45.000', 'write_uid' => '1000', 'write_date' => '2015-01-30 14:51:45.000', 'name' => 'C#高级编程_C#高级编程-主包', 'plan_type' => '102', 'parent_id' => '6193', 'date_start' => '2015-01-30 00:00:00.000', 'date_stop' => '2015-01-30 00:00:00.000', 'product_id' => '2', 'product_qty' => NULL, 'plan_director' => '', 'status' => '2', 'routing_id' => '5', 'bom_id' => NULL, 'oe_production_id' => NULL, 'note' => '', 'curr_id' => NULL, 'oe_ean13' => NULL, 'workcenter_id' => NULL, ), ), ), 4 => array ( 'id' => '6195', 'create_uid' => '1000', 'create_date' => '2015-01-30 15:12:48.000', 'write_uid' => '1000', 'write_date' => '2015-01-30 15:12:48.000', 'name' => 'C#高级编程', 'plan_type' => '102', 'parent_id' => '0', 'date_start' => '2015-01-30 00:00:00.000', 'date_stop' => '2015-01-30 00:00:00.000', 'product_id' => '2', 'product_qty' => '1', 'plan_director' => '', 'status' => '1', 'routing_id' => '2043', 'bom_id' => '1', 'oe_production_id' => '0', 'note' => 'ld', 'curr_id' => NULL, 'oe_ean13' => '9002', 'workcenter_id' => NULL, 'ischild' => 1, 'plan_director_name' => '', 0 => array ( 0 => array ( 'id' => '6196', 'create_uid' => '1000', 'create_date' => '2015-01-30 15:12:48.000', 'write_uid' => '1000', 'write_date' => '2015-01-30 15:12:48.000', 'name' => 'C#高级编程_主包', 'plan_type' => '102', 'parent_id' => '6195', 'date_start' => '2015-01-30 00:00:00.000', 'date_stop' => '2015-01-30 00:00:00.000', 'product_id' => '2', 'product_qty' => NULL, 'plan_director' => '', 'status' => '5', 'routing_id' => '5', 'bom_id' => NULL, 'oe_production_id' => NULL, 'note' => 'ld', 'curr_id' => '2008', 'oe_ean13' => NULL, 'workcenter_id' => NULL, ), ), ), 5 => array ( 'id' => '6197', 'create_uid' => '1000', 'create_date' => '2015-01-30 15:38:50.000', 'write_uid' => '1000', 'write_date' => '2015-01-30 15:38:50.000', 'name' => 'C#高级编程', 'plan_type' => '102', 'parent_id' => '0', 'date_start' => '2015-01-30 00:00:00.000', 'date_stop' => '2015-01-30 00:00:00.000', 'product_id' => '2', 'product_qty' => '1', 'plan_director' => '', 'status' => '1', 'routing_id' => '2043', 'bom_id' => '1', 'oe_production_id' => '0', 'note' => '', 'curr_id' => NULL, 'oe_ean13' => '9002', 'workcenter_id' => NULL, 'ischild' => 1, 'plan_director_name' => '', 0 => array ( 0 => array ( 'id' => '6198', 'create_uid' => '1000', 'create_date' => '2015-01-30 15:38:50.000', 'write_uid' => '1000', 'write_date' => '2015-01-30 15:38:50.000', 'name' => 'C#高级编程_次包1', 'plan_type' => '102', 'parent_id' => '6197', 'date_start' => '2015-01-30 00:00:00.000', 'date_stop' => '2015-01-30 00:00:00.000', 'product_id' => '2', 'product_qty' => NULL, 'plan_director' => '', 'status' => '3', 'routing_id' => '6', 'bom_id' => NULL, 'oe_production_id' => NULL, 'note' => '', 'curr_id' => NULL, 'oe_ean13' => NULL, 'workcenter_id' => NULL, ), 1 => array ( 'id' => '6199', 'create_uid' => '1000', 'create_date' => '2015-01-30 15:38:50.000', 'write_uid' => '1000', 'write_date' => '2015-01-30 15:38:50.000', 'name' => 'C#高级编程_主包', 'plan_type' => '102', 'parent_id' => '6197', 'date_start' => '2015-01-30 00:00:00.000', 'date_stop' => '2015-01-30 00:00:00.000', 'product_id' => '2',//富文本框限制字符串为10000所以删了些 ), ), ),)

看到这结果就昏了

if (is_array($val)) { //判断$val的值是否是一个数组,如果是,则进入下层遍历

??是

if (is_array($val)) 判?是否有下一?

谢谢各位大侠的指点错误原因找到了,后台压数据时没指定下标,直接$monitorList[$key][]=query($sql);导致前台遍历出错。

给个下标就搞定了。

php 遍历数组 只显示1个,求高手指点,foreach遍历三维数组时只能遍历出第一个子级,这是为什么呢?...相关推荐

  1. origin中文版散点图拟合曲线_origin中两组数已经画出散点图,如何新增类似于excel中的趋势线?而且是幂函式的,求高手指点...

    origin中两组数已经画出散点图,如何新增类似于excel中的趋势线?而且是幂函式的,求高手指点以下文字资料是由(历史新知网www.lishixinzhi.com)小编为大家搜集整理后发布的内容,让 ...

  2. mysql 处理一条语句卡死_一条MySQL查询语句,卡死机器,不知道为什么,求高手指点!...

    你的位置: 问答吧 -> MySQL -> 问题详情 一条MySQL查询语句,卡死机器,不知道为什么,求高手指点! 我的这条查询语句有什么问题吗?为什么一运行,机器就卡死了!N久查询不出结 ...

  3. pro* c调用存储过程 linux,Pro*C调用存储过程,存储过程名称如何传递? 高分求高手指点。。。...

    Pro*C调用存储过程,存储过程名称如何传递? 高分求高手指点...0 运行编译后的执行程序时提示错误:ORA-00900: invalid SQL statement 以下是Pro*c代码: #in ...

  4. 微型计算机48MHz辐射超,EMI辐射测试超标 求高手指点

    EMI辐射测试超标 求高手指点 niupin Post at 2011/11/15 17:29:56 各位大侠,帮忙小弟看看要怎么改? EOC产品 本帖有附件,需进入详细页面下载 [align=rig ...

  5. 求高手指点,发现98五笔有几个字三级简码和四级简码完全不同,不知道使用98五笔的亲们怎么用的?

    求高手指点,发现98五笔有几个字三级简码和四级简码完全不同,不知道使用98五笔的亲们怎么用的?比如 不:dhi,gthy 年:tgj,rhfk 才:fte,ghte 未:fii,fggy 皮:hci, ...

  6. 如何破解联网收费软件,求高手指点

    我有款软件,需要连接远端服务器,和购买时限注册码才可以登录. 注:远端服务器时不时关闭,注册码需要一个月一个月的购买. 问:1.如何更改远端服务器,或去除软件需要连接远端服务器才可登陆的设置 2.如何 ...

  7. matlab中inf函数,matlab中voronoin()函数的用法,求高手指点

    该楼层疑似违规已被系统折叠 隐藏此楼查看此楼 x = [ 0.5 0;0 0.5;-0.5 -0.5;-0.2 -0.1;-0.1 0.1;0.1 -0.1;0.1 0.1 ]; voronoi(x( ...

  8. java中输入两个数组并显示_java-将输入存储在两个相关的数组中

    我正在做一个小任务,允许用户输入任何国家的地区并将它们存储在一个阵列中.另外,每次他进入一个区域时,系统都会要求他进入该输入区域的邻居并存储这些区域. 我的想法是,每次用户进入该区域时,系统都会将其存 ...

  9. android显示加密图片,求高手android怎样实现加密比如说文件加密图片加密等???...

    满意答案 zjsyyzy 2015.10.07 采纳率:49%    等级:9 已帮助:165人 安装文件加密方法如下: 1. 我们把360手机安全卫士下载到我们的手机了,我们要把它安装到我们的手机才 ...

最新文章

  1. 在Windows10上基于WSL2运行Linux端图形应用程序
  2. 华为2013校园招聘上机笔试题
  3. 信息学奥赛一本通(1114:白细胞计数)
  4. 最近目标检测新范式汇总SparseRCNN,OneNet,DeFCN等
  5. Modules:PETCTFusion-Documentation-3.6
  6. msyql 1062
  7. mt7620n华硕固件下载_华硕TUFAX3000最新固件9923刺客模式解锁44 AX5400?
  8. Oracle隐含参数查看
  9. [无视][mark]退役记
  10. python斗地主游戏源码_Python实现的斗地主引擎
  11. 基于二值距离变换的图像细化的代码实现
  12. 群辉docker安装树莓派镜像_群晖 Docker 安装 AriaNg+File Browser
  13. 用Python玩转二维码
  14. SparkGraphX快速入门
  15. i908的串口连接中断的解决[转]
  16. 博客园自定义(全部样式分享)
  17. 移动端REM响应式模板及相应规范
  18. 如何让人更高效的完成事情
  19. 可乐瓶游戏c语言,小班活动玩可乐瓶教案
  20. 在unity中内置一个查询物流信息功能

热门文章

  1. Effective C++ 条款42
  2. php提前输出响应及注意问题
  3. 【数据结构笔记13】C实现:判别是否是同一颗二叉搜索树(BST)
  4. Congestion解决办法
  5. Conda 环境常用碎笔记
  6. Amazon S3 API
  7. 【05】CC - 格式
  8. 【前端 · 面试 】HTTP 总结(一)—— HTTP 概述
  9. 让MySQL支持InnoDB
  10. VoltDB培训PPT一则