求助:
報(bào)錯(cuò):Warning: in_array() expects parameter 2 to be array, string given in D:phpStudyWWWzhutiwp-contentthemesthemeprofunctions.php on line 98
出錯(cuò)位置:
if ( $depth == 0 && ($args->depth)>=0 && in_array( 'menu-item-has-children', $item->classes )){
$class_names[] = 'menu-item-has-children';
$atts_class[] = 'dropdown-toggle';
$atts['data-toggle'] = 'dropdown';
$caret = ' <span class="caret"></span></a>';
}
請(qǐng)問怎么修改啊
You can change the second parameter of in_array to (array)$item->classes to force the type to be converted to an array
It’s your item->classes
不是數(shù)組,是個(gè)字符串,需要將item->classes
converted into an array before use