如何显示网站';用PHP的头信息?
如何使用php获取像此网页(以下)这样的标题信息 本网站 结果:如何显示网站';用PHP的头信息?,php,http-headers,Php,Http Headers,如何使用php获取像此网页(以下)这样的标题信息 本网站 结果: HTTP Status for: "http://www.abc.com" The title is: "" Keywords: "" Description: "" HTTP/1.1 200 OK Date: Fri, 22 Feb 2013 12:00:56 GMT Server: Apache/2.2.3 (Debian) PHP/4.4.4-8+etch6 X-Powered-By: PHP/4.4.4-8+etch6
HTTP Status for: "http://www.abc.com"
The title is: ""
Keywords: ""
Description: ""
HTTP/1.1 200 OK
Date: Fri, 22 Feb 2013 12:00:56 GMT
Server: Apache/2.2.3 (Debian) PHP/4.4.4-8+etch6
X-Powered-By: PHP/4.4.4-8+etch6
Keep-Alive: timeout=300
Connection: Keep-Alive
Content-Type: text/html
使用PHPs函数获取标题:
$headers = get_headers($url, 1);
见:
如果还需要元关键字和元描述,请使用:
您可以使用:
print_r(get_headers($url));
您可以使用PHP函数
get_header()代码>。
此函数将返回一个包含所有标题字段的数组
有关更多信息,请参阅:
print_r(get_headers($url));