我收到一个错误,指出:
警告:无法修改标头信息 - 第 66 行 /home/content/21/10941021/html/register.php 中的标头已由(输出开始于 /home/content/21/10941021/html/index.php:4)发送
我想我需要放一个 ob_start() 来让缓冲正常工作,但我无法让它下来。我的问题所在的代码包括:
<div class="lower-body">
<div class="left-lower">Create an account</div>
<div id="account-first">
<?php ob_start();
if (isset($_GET['success']) && empty($_GET['success'])){
echo 'You\'ve been registered successfully!';
echo 'Please check email and activate account!';
}else {
if(empty($_POST) === false && empty($errors) === true){
$register_data = array(
'firstname' => $_POST['firstname'],
'lastname' => $_POST['lastname'],
'username' => $_POST['username'],
'password' => $_POST['password'],
'email' => $_POST['email'],
'zipcode' => $_POST['zipcode']
);
register_user($register_data);
header('Location: register.php?sucess');
exit();
} else if(empty($errors) === false){
echo output_errors($errors);
}
}
ob_end_flush();?>
然后第 4 行是这样的:
<?php
ob_start();
include 'includes/overall/head.php';
?>
有任何想法吗?非常感谢!