码迷,mamicode.com
首页 > Web开发 > 详细

ThinkPHP3.2.3 foreach嵌套循环bug

时间:2017-03-16 23:53:55      阅读:470      评论:0      收藏:0      [点我收藏+]

标签:分享   blog   ima   nbsp   [1]   each   config   logs   循环   

有两个数组authA和authB

authA如下

 1 Array
 2 (
 3     [0] => Array
 4         (
 5             [auth_id] => 1
 6             [auth_name] => 文章管理
 7             [auth_pid] => 0
 8             [auth_c] => 
 9             [auth_a] => 
10             [auth_level] => 0
11         )
12 
13     [1] => Array
14         (
15             [auth_id] => 4
16             [auth_name] => 系统设置
17             [auth_pid] => 0
18             [auth_c] => 
19             [auth_a] => 
20             [auth_level] => 0
21         )
22 
23 )

authB如下

 1 Array
 2 (
 3     [0] => Array
 4         (
 5             [auth_id] => 2
 6             [auth_name] => 文章列表
 7             [auth_pid] => 1
 8             [auth_c] => Article
 9             [auth_a] => index
10             [auth_level] => 1
11         )
12 
13     [1] => Array
14         (
15             [auth_id] => 3
16             [auth_name] => 添加文章
17             [auth_pid] => 1
18             [auth_c] => Article
19             [auth_a] => add
20             [auth_level] => 1
21         )
22 
23     [2] => Array
24         (
25             [auth_id] => 5
26             [auth_name] => 网站配置
27             [auth_pid] => 4
28             [auth_c] => Config
29             [auth_a] => index
30             [auth_level] => 1
31         )
32 
33     [3] => Array
34         (
35             [auth_id] => 6
36             [auth_name] => 网站备份
37             [auth_pid] => 4
38             [auth_c] => Config
39             [auth_a] => bak
40             [auth_level] => 1
41         )
42 
43 )

正确的循环代码是

技术分享

技术分享

 

若是把vv改成authB,则会出现bug

技术分享

换成其他非authB则不会出现问题

 

ThinkPHP3.2.3 foreach嵌套循环bug

标签:分享   blog   ima   nbsp   [1]   each   config   logs   循环   

原文地址:http://www.cnblogs.com/lwn007/p/6562027.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!