bool header_register_callback ( callable $callback )
它将注册PHP开始发送输出时将调用的函数
Sr.No | 参数 & Description |
---|---|
1 |
callback 它在发送标头之前调用。 |
成功时返回TRUE,失败时返回FALSE。
链接:https://www.learnfk.comhttps://www.learnfk.com/php/php-header-register-callback.html
来源:LearnFk无涯教程网
<?php header('Content-Type: text/plain'); header('X-Test: f1'); function f1() { foreach (headers_list() as $header) { if (strpos($header, 'X-Powered-By:') !== false) { header_remove('X-Powered-By'); } header_remove('X-Test'); } } $result=header_register_callback('f1'); echo "learnfk"; ?>
这将产生以下输出-
learnfk
上面的示例将注册标头,并将回调标头作为文本,如上所述
祝学习愉快!(内容编辑有误?请选中要编辑内容 -> 右键 -> 修改 -> 提交!)