【发布时间】:2010-07-29 08:10:19
【问题描述】:
我的index.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());
?>
但后续警告消息即将到来- 警告:无法修改标头信息 - 标头已由第 4 行 C:\xampp\htdocs\pics\index.php 中的(输出从 C:\xampp\htdocs\pics\index.php:1 开始)发送
【问题讨论】:
-
您在打开
-
如果设置了 BOM,则它是文件开头的两个字符,由编辑器(记事本?)设置但通常不显示。当您使用“另存为”保存文件时,您为“编码”提供了哪些选项?
-
您的脚本不包含任何 UTF-8 字符,因此只需选择 ANSI
-
嗯,很奇怪。答案正是我所说的?我是第一个回答的?
标签: php http-headers warnings