如何检测 HTTP 请求标头中是否存在“Sec-GPC:1”?
<?PHP function detect_gpc_signal() {
if (isset($_GET['Sec-Gpc'])) {
echo 'GPC signal detected in GET data';
} elseif (isset($_POST['Sec-Gpc'])) {
echo 'GPC signal detected in POST data';
} elseif (isset($_COOKIE['Sec-Gpc'])) {
echo 'GPC signal detected in COOKIE data';
} elseif (isset($_SERVER['Sec-Gpc'])) {
echo 'GPC signal detected in SERVER data';
} else {
echo 'No GPC signal detected';
}
}
add_action('wp_footer', 'detect_gpc_signal'); ?> Copyright 2014-2026 https://www.php.cn/ All Rights Reserved | php.cn | 湘ICP备2023035733号