可我删除了上面一段 <?php $count++; setcookie("count",$count); ?> welcome! You bee <?php echo($count.($count==1?"time!":"times!"));?> 还是报同样的问题 Warning: Cannot modify header information - headers already sent by (output started at D:\web\counte.php:2) in D:\web\counte.php on line 4 welcome! You bee 1time!
开始 <?php Header("Location: http://www.php.net"); exit; ?> 报错 at D:\web\counte.php:2) in D:\web\counte.php on line 3 注意:2 和 3 后来 <?php $count++; setcookie("count",$count); ?> 报错 at D:\web\counte.php:2) in D:\web\counte.php on line 4 注意:2 和 4可见你的第一行是空行,删掉就可以了
还是不行啊!! ########## <?php Header("Location: http://www.php.net"); exit; ?> ######### Internal Server Error The server encountered an internal error or misconfiguration and was unable to complete your request.Please contact the server administrator, [email protected] and inform them of the time the error occurred, and anything you might have done that may have caused the error.More information about this error may be available in the server error log. --------------------------------------------------------------------------------Apache/2.0.43 Server at localhost Port 80 ######### 谁知道为什么啊!!我快疯了!!
我用下程序同样的错,是不是 php.ini 那要修改啊!! <?php if (!isset($_SERVER['PHP_AUTH_USER'])) { header('WWW-Authenticate: Basic realm="My Realm"'); header('HTTP/1.0 401 Unauthorized'); echo 'Text to send if user hits Cancel button'; exit; } else { echo "<p>Hello {$_SERVER['PHP_AUTH_USER']}.</p>"; echo "<p>You entered {$_SERVER['PHP_AUTH_PW']} as your password.</p>"; } ?>
如果代码仅仅就:
<?php
Header("Location: http://www.php.net");
exit;
?>
的话是可以执行的,
如果在header页有输出连着他的话就不可能执行,改成:
<Script language=javascript>window.location.href='yoururl'</script>
<?php
$count++;
setcookie("count",$count);
?>
welcome! You bee
<?php
echo($count.($count==1?"time!":"times!"));?>
还是报同样的问题
Warning: Cannot modify header information - headers already sent by (output started at D:\web\counte.php:2) in D:\web\counte.php on line 4
welcome! You bee 1time!
<?
$count++;
setcookie("count",$count);
?>
welcome! You bee
<?
echo($count." ".($count==1?"time!":"times!"));
?>
<?php
Header("Location: http://www.php.net");
exit;
?>
报错
at D:\web\counte.php:2) in D:\web\counte.php on line 3
注意:2 和 3
后来
<?php
$count++;
setcookie("count",$count);
?>
报错
at D:\web\counte.php:2) in D:\web\counte.php on line 4
注意:2 和 4可见你的第一行是空行,删掉就可以了
##########
<?php
Header("Location: http://www.php.net");
exit;
?>
#########
Internal Server Error
The server encountered an internal error or misconfiguration and was unable to complete your request.Please contact the server administrator, [email protected] and inform them of the time the error occurred, and anything you might have done that may have caused the error.More information about this error may be available in the server error log.
--------------------------------------------------------------------------------Apache/2.0.43 Server at localhost Port 80
#########
谁知道为什么啊!!我快疯了!!
<?php
if (!isset($_SERVER['PHP_AUTH_USER'])) {
header('WWW-Authenticate: Basic realm="My Realm"');
header('HTTP/1.0 401 Unauthorized');
echo 'Text to send if user hits Cancel button';
exit;
} else {
echo "<p>Hello {$_SERVER['PHP_AUTH_USER']}.</p>";
echo "<p>You entered {$_SERVER['PHP_AUTH_PW']} as your password.</p>";
}
?>
<?php
Header("Location: http://www.php.net");
?>如果你只是想跳转,也不妨试试,echo "<META HTTP-EQUIV=REFRESH CONTENT='0;URL=main.php'>";
如果这都不成,那就看看你的配置问题,恐怕php配置都有问题!
真是气人,
它说 什么已经 sent
不知道是怎么回事???