PHP 获取 HTTP 响应头信息 - get_headers() 函数
PHP 中可以使用 get_headers() 函数来获取 HTTP 响应头信息。该函数接受一个 URL 作为参数,并返回一个包含响应头信息的数组。
以下是一个示例:
$url = 'https://www.example.com';
$headers = get_headers($url);
foreach ($headers as $header) {
echo $header . '<br>';
}
上述代码将获取 https://www.example.com 的响应头信息,并将每个头信息打印出来。
原文地址: https://www.cveoy.top/t/topic/l7zN 著作权归作者所有。请勿转载和采集!