为什么调试器不在 drupal hook_menu 函数中停止?

Why doesn't debugger stop in a drupal hook_menu function?

我正在尝试验证 hook_menu 函数是否正在执行,但调试器 (netbeans) 不会在该函数设置的断点处停止。它会在模块文件中设置的回调处停止,但不会在 hook_menu 函数处停止。

Drupal 文档写道:

This hook enables modules to register paths in order to define how URL requests are handled. Paths may be registered for URL handling only, or they can register a link to be placed in a menu (usually the Navigation menu). A path and its associated information is commonly called a "menu router item". This hook is rarely called (for example, when modules are enabled), and its results are cached in the database.

您可以使用 devel 模块,它提供了一些开发链接,您可以在其中 rebuild menu 每次调用您的 hook_menu