无法修改标题信息 - 已经发送的标题 [英] Cannot modify header information - headers already sent by

查看:164
本文介绍了无法修改标题信息 - 已经发送的标题的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

 < div id =left-body-part-innerpage> 
< h1 class =mainheading>联络我们< / h1>
< div id =contactus-right-divclass =content>
<?php session_start();
if(isset($ _ POST ['button2']))
{
if($ _SESSION ['security_code'] == $ _POST ['security_code']&&!empty ($ _SESSION ['security_code']))
{
$ name = $ _POST ['name'];
//在这里插入用于处理表单的代码,例如通过电子邮件发送提交,将其输入到数据库中。
session_destroy();
header(Location:contactdb.php);
?>

我得到警告:session_start()[function.session-start]:无法发送会话缓存限制器 - 在网站上发送的头文件(输出在网站开始)



警告:不能修改头文件信息 -

可以帮助我吗?

预先感谢....

作为一般规则,在开始输出内容之前,先执行所有业务逻辑(例如会话管理)。

正如已经指出的那样,开始打印页面内容将自动发送标题。


<div id="left-body-part-innerpage">
    <h1 class="mainheading">Contact Us</h1>
    <div id="contactus-right-div" class="content">
    <?php session_start();
        if( isset($_POST['button2']))           
        {
            if( $_SESSION['security_code'] == $_POST['security_code'] && !empty($_SESSION['security_code'] ) ) 
            {
                $name = $_POST['name'];
                // Insert you code for processing the form here, e.g emailing the submission, entering it into a database. 
                session_destroy();
                header("Location: contactdb.php");
?>

i am getting Warning: session_start() [function.session-start]: Cannot send session cache limiter - headers already sent (output started at website) in website

Warning: Cannot modify header information - headers already sent by (output started at website) in website

can any one help me?

Thanks in advance....

解决方案

As a general rule, do all business logic first (such as session management) before starting output of content.

As already pointed out, starting to print page content will automatically send headers.

这篇关于无法修改标题信息 - 已经发送的标题的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆