重複の可能性:
PHP によって既に送信されたヘッダー
wordpress テーマのホームページでヘッダーが既に送信されたエラーを受け取りました。私の関数は次のようになります。
function LoopCokiee() {
if(isset($_COOKIE['PozCounter']))
{
setcookie("PozCounter", ++$_COOKIE['PozCounter'], time()+3600);
}
else
{
setcookie("PozCounter", 1, time()+3600);
}
return $_COOKIE['PozCounter'];
}
function LoopCokieeUpdate () {
$Kuki = $_COOKIE['PozCounter'];
$Topl = '20'; //wp_count_posts()->publish;
if ($Kuki > $Topl ) {
setcookie("PozCounter", 1, time()+3600);
} else {
return $_COOKIE['PozCounter'];
}
}
これは私のローカルでは完全に機能しますが、ホストゲーターの何が問題なのか理解できませんでしたか?
関数を呼び出したとき。
<?php
LoopCokiee();
LoopCokieeUpdate();
echo '<!--LoopResults--'.LoopCokiee().'//'.LoopCokieeUpdate().'-->'
?>
このエラーが表示されます。
Warning: Cannot modify header information - headers already sent by (output started at /home/igze/public_html/ddddd.com/wp-content/themes/smooth/home.php:1) in /home/igze/public_html/ddddd.com/wp-content/themes/smooth/PozHook/index.php on line 11
Warning: Cannot modify header information - headers already sent by (output started at /home/igze/public_html/ddddd.com/wp-content/themes/smooth/home.php:1) in /home/igze/public_html/ddddd.com/wp-content/themes/smooth/PozHook/index.php on line 11
私は何をすべきか ?おかげで役に立ちます。