标题功能不能正常工作PHP [英] Header function not working PHP
本文介绍了标题功能不能正常工作PHP的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
成功注册后,我重定向了一个页面,代码正在正常工作,但标题功能无法正常工作。页面不重定向。
I redirecting a page after successful registration the code is working everythig work properly but the header function not working & page not redirect. the page not get redirect .my code is given below
<?php
error_reporting(E_ALL ^ E_NOTICE);
error_reporting(E_ALL ^ E_WARNING);
//include("lib/local_config.php");
include("lib/config.php");
$activation=md5(uniqid(rand(), true));
if(isset($_POST["tb_submit"]))
{
$fname=$_POST["tb_fname"];
$email=$_POST["tb_email"];
$pass=$_POST["tb_pass"];
$repass=$_POST["tb_repass"];
$contact=$_POST["tb_contact"];
$select_email=mysql_query("select email from user_reg where email='$email'");
$rows=mysql_fetch_row($select_email);
$e_id=$rows[0];
if(!$email==$e_id && $pass==$repass)
{
$insert="insert into user_reg ( fname ,email ,password ,contact,Activation) values ('$fname' , '$email' , '$pass' ,'$contact' ,'$activation')";
$insert_query=mysql_query($insert);
if(mysql_affected_rows($connect) == 1)
//if(mysql_affected_rows() == 1)
{
$to = $_POST['tb_email'];
$subject = "Fundu App Creator - Registration confirmation mail ";
$message = <<<DEMO
<html>
<head>
<link href='http://www.fundumobi.com/app/templatemo_style.css' type='text/css'
rel='stylesheet' />
<link href='http://www.fundumobi.com/app/styles/frm.css' rel='stylesheet'
type='text/css' />
<style type='text/css'>
.style1 {
font-size: 14px;
font-style: italic;
font-weight: bold;
}
.style2 {color: #FFFFFF}
</style>
</head>
<body>
<table width='50%' border='0' align='center'>
<tr>
<th height='100' bgcolor='#006784'>
<div id='site_logo'></div> </th>
</tr>
<tr>
<td height='247'><div >
<div align='center' class='style1'>
<p>Your Registration is successful !!!! </p>
<p>Now Please click the following Button to complete the registration process:</p>
<p> </p><br/>
<div ><a href='http://www.fundumobi.com/app/activation.php?act=$activation'>
<img src='images/button66535179.png'/></a></div>
</div></td>
</tr>
<tr>
<td height='64' bgcolor='#006784'><div
align='center'>www.funduappcreator.com</div> </td>
</tr>
</table>
</body>
</html>
DEMO;
$from = "contact@fundumobi.com";
mail($to, $subject, $message, 'From:'.$from);
header("location:mesg.php");
}
else
{ // If it did not run OK.
header("location:index.php?er=2");
}
}
}
?>
推荐答案
输出内容后无法发送标题。这里你输出的是whitespcace之前的PHP标签:
You can't send headers after outputting content. Here you are outputting whitespcace before the PHP tag:
<?php
^^ remove this whitespace
检查您的错误日志,您会发现:
Check your error log and you'll find:
警告:无法修改标题信息 - 已发送标题
Warning: Cannot modify header information - headers already sent
这篇关于标题功能不能正常工作PHP的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文