数组中未定义的偏移量

时间:2014-01-15 20:25:07

标签: php arrays

我收到了PHP通知

  

未定义的偏移量:143

这是代码:

function dropdownCat($cat_id = 0, $level = 1, $settings) {
  global $cPath_array, $current_category_id, $db, $cat;
  $output = '';
  $categoriesData = $cat->categoriesDataAll[$cat_id];
  if (!$categoriesData) {
   return false;
  }
  foreach ($categoriesData as $categories) {
  ...
    $output .= $categories['categories_name'];
  ...
  }
  return $output;
}

输出数组的开头如下:

Array
(
  [143] => Array
  (
    [categories_id] => 143
    [categories_name] => Cat1
    [parent_id] => 0
  )

  [416] => Array
  (
    [categories_id] => 416
    [categories_name] => Cat2
    [parent_id] => 0
  )
)

为什么我会收到此PHP通知。存在所有数组变量。

0 个答案:

没有答案