ThinkPHP3.2.3 foreach嵌套循环bug

时间:2022-09-08 12:07:58

有两个数组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 )

正确的循环代码是

ThinkPHP3.2.3 foreach嵌套循环bug

ThinkPHP3.2.3 foreach嵌套循环bug

 

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

ThinkPHP3.2.3 foreach嵌套循环bug

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