我在php和mysql中制作了一个简单的登录系统,但是我不断收到错误消息,说明已经发送了标头,并且使用ob_start可以解决此问题,但是我不确定以后是否应该在页脚使用ob_clean?
另外,当我登录到帐户页面时,错误消息就会出现,说标题已在上一页中发送-> header(“ Location:account.php”);但是我必须在用户登录时重定向用户.
我的登录页面如下所示
require_once('models/init.php'); // db connection and other functions
include('header.php'); // some html code for the header, with one line php-function to check if user is logged in, if so show "home" tab instead of "login"
{
php code to check if username/pass matches etc, and if so redirect to account page
header("Location: account.php");
}
echo "
" // display the login forminclude("footer"); // including footer, some html/js code.
如果我在header.php文件中使用ob_start,则上面的代码有效.但是之后我应该在footer.php文件中使用ob_clean吗?
抱歉,如果不清楚,英语不是我的母语
谢谢!