initializers

initializers 块如下所示:

  1. {
  2. "initializers": [
  3. {
  4. "globals": [
  5. {
  6. "include": "my/awesome/library.h",
  7. "code": "setup_globals_deps(TSRMLS_C)"
  8. }
  9. ],
  10. "module": [
  11. {
  12. "include": "my/awesome/library.h",
  13. "code": "setup_module_deps(TSRMLS_C)"
  14. }
  15. ],
  16. "request": [
  17. {
  18. "include": "my/awesome/library.h",
  19. "code": "some_c_function(TSRMLS_C)"
  20. },
  21. {
  22. "include": "my/awful/library.h",
  23. "code": "some_other_c_function(TSRMLS_C)"
  24. }
  25. ]
  26. }
  27. ]
  28. }

这个块负责定义到上面图中显示的Init事件的钩子。 其中有三个:globals用于设置全局变量空间;module用于设置扩展本身需要功能的任何内容;request用于设置扩展来处理单个请求。