PHP:get_headers()的用法_url函数

技术教程2个月前发布 北陌
349 00

PHP:get_headers()的用法_url函数

get_headers

(PHP 5)

get_headers — 取得服务器响应一个 HTTP 请求所发送的所有标头

说明

array get_headers
( string $url
[, int $format = 0
] )

get_headers() 返回一个数组,包含有服务器响应一个
HTTP 请求所发送的标头。

参数

url

目标 URL。

format

如果将可选的 format 参数设为 1,则
get_headers() 会解析相应的信息并设定数组的键名。

返回值

返回包含有服务器响应一个
HTTP 请求所发送标头的索引或关联数组,如果失败则返回 FALSE

更新日志

版本
说明
5.1.3
自 PHP 5.1.3 起本函数使用默认的流上下文,其可以用 stream_context_get_default()
函数设定和修改。

范例

Example #1 get_headers() 例子

$url

© 版权声明

相关文章

暂无评论

none
暂无评论...