if($_SERVER['HTTP_IF_NONE_MATCH'])
{
if($_SERVER['HTTP_IF_NONE_MATCH'] == 'phpblog')
{
header('Etag:phpblog',true,304);//控制浏览器缓存
$_SESSION['time_end']=microtime(true);
exit();
}
}
else if($_SERVER['HTTP_IF_MODIFIED_SINCE'])//eg:Sun, 02 Nov 2008 07:08:25 GMT; length=35849
{
$array=explode(' ',$_SERVER['HTTP_IF_MODIFIED_SINCE']);
$gmday=$array[1];
$month_array=array(
"Jan"=>"01",
"Feb"=>"02",
"Mar"=>"03",
"A
pr"=>"04",
"May"=>"05",
"Jun"=>"06",
"Jul"=>"07",
"Aug"=>"08",
"Sep"=>"09",
"Oct"=>"10",
"Nov"=>"11",
"Dec"=>"12");
$gmmonth=$month_array[$array[2]];
$gmyear=$array[3];
$array=explode(':',$array[4]);
$gmtimestamp=gmmktime($array[0],$array[1],$array[2],$gmmonth,$gmday,$gmyear);
if(gmmktime()-$gmtimestamp<$config_client_cache_time*60*60)
{
header('Etag:phpblog',true,304);//控制浏览器缓存
$_SESSION['time_end']=microtime(true);
exit();
}
}
if($_SERVER['HTTP_IF_NONE_MATCH']) { if($_SERVER['HTTP_IF_NONE_MATCH'] == 'phpblog') { header('Etag:phpblog',true,304);//控制浏览器缓存 $_SESSION['time_end']=microtime(true); exit(); } } else if($_SERVER['HTTP_IF_MODIFIED_SINCE'])//eg:Sun, 02 Nov 2008 07:08:25 GMT; length=35849 { $array=explode(' ',$_SERVER['HTTP_IF_MODIFIED_SINCE']); $gmday=$array[1]; $month_array=array( "Jan"=>"01", "Feb"=>"02", "Mar"=>"03", "Apr"=>"04", "May"=>"05", "Jun"=>"06", "Jul"=>"07", "Aug"=>"08", "Sep"=>"09", "Oct"=>"10", "Nov"=>"11", "Dec"=>"12"); $gmmonth=$month_array[$array[2]]; $gmyear=$array[3]; $array=explode(':',$array[4]); $gmtimestamp=gmmktime($array[0],$array[1],$array[2],$gmmonth,$gmday,$gmyear); if(gmmktime()-$gmtimestamp<$config_client_cache_time*60*60) { header('Etag:phpblog',true,304);//控制浏览器缓存 $_SESSION['time_end']=microtime(true); exit(); } }