menu钩子中的path不能重名与$may_cache

 各个menu钩子中的path不能重名,如果重名的话,会使用第一个path

比如product.module中有个函数如下:
function product_menu($may_cache) {
  $items = array();
if (!$may_cache) {
    $items[] = array(
      'path' => 'product',
      'title' => t('Products'),
      'callback' => 'product_page',
      'access' => user_access('access content'),
    );
  return $items;
}
 
而重新写的模块ec_shop_prodcut.module中也有
 
function ec_shop_prodcut_menu($may_cache) {
  $items = array();
if (!$may_cache) {
    $items[] = array(
      'path' =>'product',
      'title' =>t('Products'),
      'callback' =>'product_page',
      'access' =>user_access('access content'),
    );
  return $items;
}
 
这种情况下会引用第一个product.module里的path对应的函数。
 
 
如果新写了一个menu钩子的$items不起作用,有可能就是$may_cache的问题,你可以把
if ($may_cache)改成if (!$may_cache)试试。