本篇文章主要讲述了使用php接收http请求头信息,具有一定的参考价值,感兴趣的朋友可以学习一下。
foreach (getallheaders() as $name => $value) { echo "$name: $value\n"; }
function em_getallheaders() { $headers = []; foreach ($_SERVER as $name => $value) { if (substr($name, 0, 5) == 'HTTP_') { $headers[str_replace(' ', '-', ucwords(strtolower(str_replace('_', ' ', substr($name, 5)))))] = $value; } } return $headers; }
相关教程:PHP视频教程
以上就是如何用PHP接收http请求头信息的详细内容,更多请关注php中文网其它相关文章!
Copyright 2014-2024 https://www.php.cn/ All Rights Reserved | php.cn | 湘ICP备2023035733号