我index.php
頁面代碼是 -無法修改標題信息PHP中的警告信息?
<?php
if(!$_COOKIE['authorized'] == 1) {
header("Location: login.php");
}
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org /TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title>My Photo Website</title>
<script src="js/jquery-1.2.6.pack.js" type="text/javascript"></script>
<script src="js/jquery.lightbox-0.5.pack.js" type="text/javascript"></script>
<script src="js/myscript.js" type="text/javascript"></script>
<link rel="stylesheet" href="css/default.css" />
<link rel="stylesheet" href="css/jquery.lightbox-0.5.css" />
</head>
<body>
<form method="post" action="changePhotoTitle.php">
<div id="container">
<h1>My Photos <small>click on the text to change the title.</small></h1>
<a href="login.php?logout=1" id="logout">logout</a>
<div id="main">
<?php require 'getPhotos.php'; ?>
<div id="response" class="hidden" />
</div><!-- end main-->
</div><!-- end container-->
</form>
</body>
</html>
我database.php中頁面的代碼是 -
<?php
$db_name = "db";
$db_server = "localhost";
$db_user = "root";
$db_pass = "";
$mysqli = new MySQLi($db_server, $db_user, $db_pass, $db_name) or die(mysqli_error());
?>
但followong警告消息coming- 警告:不能更改頭信息 - 頭已經在第4行的C:\ xampp \ htdocs \ pics \ index.php中發送(輸出開始於C:\ xampp \ htdocs \ pics \ index.php:1)
看看http://www.tech-recipes.com/rx/1489/solve-php-error-cannot-modify-header-information-headers-already-sent/ – 2010-07-29 08:13:11
你有沒有任何空白打開<?php或者您的文件是否有BOM表頭? – 2010-07-29 08:13:11
哪裏是BOM? – nectar 2010-07-29 08:21:30