警告:in_array()期望参数2为数组,在第229行文件位置隐藏安全中给出
第223-235行
\#(.*?)
我已添加内插数字,以帮助了解线条的位置。 任何帮助将不胜感激
答案 0 :(得分:3)
您需要确保$mgroup_others_array
实际上是一个数组。
您可以将if
更改为:
if (is_array($mgroup_others_array) && in_array($id, $mgroup_others_array)) {
这会阻止你warning
。您无法对不属于该变量的变量执行in_array()
调用。
答案 1 :(得分:0)
你也可以这样做:
if (count($dmos_forum_ids) > 0) {
$new_mgroup_others_array = array();
if(!is_array($mgroup_others_array))
$mgroup_others_array = array();
// Loop through the new mgroups and make sure they are added to the existing
foreach ($dmos_forum_ids as $id)
{
if (in_array($id, $mgroup_others_array))
{
array_push($new_mgroup_others_array, $id);
}
}
}