简体   繁体   English

为foreach提供了无效的参数

[英]Invalid argument supplied for foreach

I have got this warning, have someone an idea: 我得到了这个警告,有人建议:

warning: Invalid argument supplied for foreach() in C:\\xampp\\htdocs\\testplanning\\modules\\planning\\planning.module on line 425.

The code where he the fall is: 他跌倒的代码是:

foreach($stap3[2] as $key => $value) {
    $waardeSoortStage[$key] = $value;
}

变量$stap3[2]可能不是数组。

I think you wanted to do so: 我认为您想这样做:

foreach($stap3 as $key => $value) {
    $waardeSoortStage[$key] = $value;
}

because I think $stap3 is your array, $stab3[2] might only be one member of it. 因为我认为$stap3是您的数组,所以$stab3[2]可能只是其中的一个成员。

$stap3[2] is not an array or an empty array. $stap3[2]不是数组或空数组。

You can check $stap3[2] with is_array($stap3[2]) If is really array it returns true. 您可以使用is_array($stap3[2])检查$stap3[2] 。如果确实是数组,则返回true。

Also you can debug it with var_dump($stap3[2]) 您也可以使用var_dump($stap3[2])进行调试

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM