Warning: in_array() expects parameter 2 to be array
PHP中文网
PHP中文网 2017-04-19 16:59:53
0
1
2087

求助:报错:Warning: in_array() expects parameter 2 to be array, string given in D:phpStudyWWWzhutiwp-contentthemesthemeprofunctions.php on line 98

出错位置:

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>';
}

请问怎么修改啊


PHP中文网
PHP中文网

认证高级PHP讲师

reply all(1)
大家讲道理

That is, your item->classes is not an array, but a string. You need to convert item->classes into an array before using it

Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template