注意:未定义的偏移量:footer.php中的1

<?php $menu=wp_nav_menu( array( 'echo'=>0, 'theme_location' => 'primary','depth' => 1));             
/* extracting and then seperating the li's coming from wp_nav_menu function and storing them into array */
$menu=explode('menu">',$menu);
$menu=explode('</ul></div>',$menu[1]);
$menu=explode('<li',$menu[0]);
$total=count($menu);
$count=1;
foreach($menu as $menuitem){
/*extracting link and name of post from the  li string.*/
$link=strstr($menuitem,'href');
$array=explode('>',$link);
$name=explode('</a',$array[1]);
$name=$name[0];
$link=$array[0];

I am getting an undefined offset 1 error on the $array=explode('>' ,$link); line. This only started happening since the latest Wordpress update. Visually and functionally the footer menu works on the page, but the error message persists above it. I can not figure this out. Please help if you can.