destructors

destructors 块如下所示:

{
    "destructors": [
        {
            "request": [
                {
                    "include": "my/awesome/library.h",
                    "code": "c_function_for_shutting_down(TSRMLS_C)"
                },
                {
                    "include": "my/awful/library.h",
                    "code": "some_other_c_function_than_the_other_ones(TSRMLS_C)"
                }
            ],
            "post-request": [
                {
                    "include": "my/awesome/library.h",
                    "code": "c_function_for_cleaning_up_after_the_response_is_sent(TSRMLS_C)"
                }
            ],
            "module": [
                {
                    "include": "my/awesome/library.h",
                    "code": "release_module_deps(TSRMLS_C)"
                }
            ],
            "globals": [
                {
                    "include": "my/awesome/library.h",
                    "code": "release_globals_deps(TSRMLS_C)"
                }
            ]
        }
    ]
}

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