我有一个名为 $users 的数组,如下所示:
$users = Array
(
[d3c1ac9ac08da86e73258a11a43251af] => enable
[b993166c4795b3bfe96640e55e8dcbbc] => enable
[77d4721ada7677feda77a250c7cee1c4] => disable
[68d6e7a8c09c77c5fec49945beaea4f8] => disable
[85634bc9cdbcb6b39eaf4946b99db5de] => disable
[bb1a20794d65966b950c5933100496ce] => disable
[59ee376a9d126a26b350fff3110ea825] => disable
[428895b1ae5f3226345e6c6f256c7c85] => disable
[78a619902b22a1f17def5198179334be] => disable
[ab5ca5cbfd45c7bd0e0817b200597682] => disable
[2e0ae6cdce7647daf73d3d370a7a12f8] => disable
[867d3433169d05323a4ff350ca21b1c9] => disable
[3dddd9a46cfeb4e4d3607fb178113656] => disable
[ba908fd0f04f245c82ed379bd3f57285] => disable
[ec702094416ad4789288f3f64b3537a7] => disable
[cbb677ed11c1838281c6962d52f62b8a] => disable
[45a1e20492f043d404580becad029f12] => disable
[8b1acc0101378e60985f8200fa3900de] => disable
[f063e4cd1b86f389f2647c4211498615] => disable
[f3639eb674adbb243579942d3746044a] => disable
)
现在我有以下循环:
foreach ($users as $id => $status) {
if($status == disable) { echo "Yes"; die;
$objAdminUsers->UpdateUserStatus($id, $status);
$count++;
}
}
我的问题是当我一个一个遍历数组时,我无法进入 if 条件。但是,当我放入单个数组元素时,if 条件有效并且一切正常。您能指导我为什么在遍历数组时无法进入 if 条件吗?我在上面用代码编写的示例消息也没有得到回显。你能在这方面帮助我吗?提前致谢。