destructors

destructors 块如下所示:

  1. {
  2. "destructors": [
  3. {
  4. "request": [
  5. {
  6. "include": "my/awesome/library.h",
  7. "code": "c_function_for_shutting_down(TSRMLS_C)"
  8. },
  9. {
  10. "include": "my/awful/library.h",
  11. "code": "some_other_c_function_than_the_other_ones(TSRMLS_C)"
  12. }
  13. ],
  14. "post-request": [
  15. {
  16. "include": "my/awesome/library.h",
  17. "code": "c_function_for_cleaning_up_after_the_response_is_sent(TSRMLS_C)"
  18. }
  19. ],
  20. "module": [
  21. {
  22. "include": "my/awesome/library.h",
  23. "code": "release_module_deps(TSRMLS_C)"
  24. }
  25. ],
  26. "globals": [
  27. {
  28. "include": "my/awesome/library.h",
  29. "code": "release_globals_deps(TSRMLS_C)"
  30. }
  31. ]
  32. }
  33. ]
  34. }

正如 initializers 块负责定义上图中显示的 init 事件中的挂钩一样, this 块负责定义关机事件中的挂钩。 有四个:request响应之前敲定任何数据发送到客户端,post-request清理响应被发送后,module</0 >模块扩展后的清理本身PHP进程关闭之前, 和<code>globals清理全局变量空间。