php - Warning: in_array() expects parameter 2 to be array
我想大声告诉你
我想大声告诉你 2017-05-16 13:11:53
0
2
1121

求助:
报错: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 = ' '; }

请问怎么修改啊

我想大声告诉你
我想大声告诉你

reply all (2)
洪涛

You can change the second parameter of in_array to (array)$item->classes to force the type to be converted to an array

    PHPzhong

    It’s youritem->classes不是数组,是个字符串,需要将item->classesconverted into an array before use

      Latest Downloads
      More>
      Web Effects
      Website Source Code
      Website Materials
      Front End Template
      About us Disclaimer Sitemap
      php.cn:Public welfare online PHP training,Help PHP learners grow quickly!