【发布时间】:2013-11-26 06:45:54
【问题描述】:
我有这个页面浏览计数器的功能:
function PageViews($postID) {
$c_key = 'views_count';
$cookie_count = $_COOKIE['views_count_'.$postID];
$count = get_post_meta($postID, $c_key, true);
if(!$cookie_count){
setcookie('views_count_'.$postID , 'view', time()+999999999);
if($count == ''){
$count = 1;
update_post_meta($postID, $c_key, $count);
return $count;
}else{
$count++;
update_post_meta($postID, $c_key, $count);
return $count;
}
}else{
return $count;
}
}
当我去查看帖子时,我得到了这个错误:
Warning: Cannot modify header information - headers already sent by (output started at....
我的 cookie 没有设置,这个函数在 function.php 中。这个cookie怎么设置?
【问题讨论】: