>  Q&A  >  본문

Warning: in_array() expects parameter 2 to be array

求助:报错: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中文网2713일 전2001

모든 응답(1)나는 대답할 것이다

  • 大家讲道理

    大家讲道理2017-04-19 17:00:57

    즉, item->classes는 배열이 아니라 문자열입니다. 사용하기 전에 item->classes를 배열로 변환해야 합니다.

    회신하다
    0
  • 취소회신하다