Voting

: min(four, five)?
(Example: nine)

The Note You're Voting On

Weboide
14 years ago
Note that get_headers **WILL follow redirections** (HTTP redirections). New headers will be appended to the array if $format=0. If $format=1 each redundant header will be an array of multiple values, one for each redirection.

For example:

<?php
$url
= 'http://google.com';
var_dump(get_headers($url,0));
/*array(18) {
[0]=> string(30) "HTTP/1.0 301 Moved Permanently"
[1]=> string(32) "Location: http://www.google.com/"
[2]=> string(38) "Content-Type: text/html; charset=UTF-8"
[3]=> string(35) "Date: Sun, 26 Sep 2010 00:59:50 GMT"
[4]=> string(38) "Expires: Tue, 26 Oct 2010 00:59:50 GMT"
[5]=> string(38) "Cache-Control: public, max-age=2592000"
....
string(15) "HTTP/1.0 200 OK"
[10]=> string(35) "Date: Sun, 26 Sep 2010 00:59:51 GMT"
[11]=> string(11) "Expires: -1"
[12]=> string(33) "Cache-Control: private, max-age=0"
.....
}*/

/*===========================*/

var_dump(get_headers($url,1));
/*array(11) {
[0]=>
string(30) "HTTP/1.0 301 Moved Permanently"
["Location"]=> string(22) "http://www.google.com/"
["Content-Type"]=> array(2) {
[0]=> string(24) "text/html; charset=UTF-8"
[1]=> string(29) "text/html; charset=ISO-8859-1"
}
["Date"]=> array(2) {
[0]=> string(29) "Sun, 26 Sep 2010 01:03:39 GMT"
[1]=> string(29) "Sun, 26 Sep 2010 01:03:39 GMT"
}
["Expires"]=> array(2) {
[0]=> string(29) "Tue, 26 Oct 2010 01:03:39 GMT"
[1]=> string(2) "-1"
}
["Cache-Control"]=> array(2) {
[0]=> string(23) "public, max-age=2592000"
[1]=> string(18) "private, max-age=0"
}
.....
}*/
?>

<< Back to user notes page

To Top