Why is this result 136
? This 136
is the first character of the id title name
field. Isn’t $v2 itself a one-dimensional array? $v2 can print all data. Why is $v2['id'] not 1 but this is the case? why is that?
<code>$bao=M('bao'); $res=$bao->select(); foreach($res as $v){ foreach($v as $v2){ echo $v2['id']; } }</code>
Why is this result 136
? This 136
is the first character of the id title name
field. Isn’t $v2 itself a one-dimensional array? $v2 can print all data. Why is $v2['id'] not 1 but this is the case? why is that?
<code>$bao=M('bao'); $res=$bao->select(); foreach($res as $v){ foreach($v as $v2){ echo $v2['id']; } }</code>
I don’t understand why you need to loop twice. You can get the ID in the first loop, and then traverse each column in the second loop. This will cause problems
The loop inside corresponds to each field, so $v2['id'] does not exist. If the error prompt is turned to the maximum, a notice will be reported
Because the data produced by Selsect is a two-dimensional array, and the data produced by find is a one-dimensional array.