您好,我正在创建登录/注册,数据库通信已经正常(数据get已按预期存储和加载)。我使用Adobe Muse设计登录页面,并使用表单小部件创建输入。在"login.html“页面上,我有以下表单:
<form class="form-grp clearfix mse_pre_init" id="widgetu63897" method="post" enctype="multipart/form-data" action="login_script.php">
<div class="fld-grp clearfix grpelem" id="widgetu63910" data-required="true"><!-- none box -->
<span class="fld-input NoWrap actAsDiv rounded-corners clearfix grpelem" id="u63913-4"><!-- content --><input class="wrapped-input" type="email" spellcheck="false" id="widgetu63910_input" name="email" tabindex="1"/><label class="wrapped-input fld-prompt" id="widgetu63910_prompt" for="widgetu63910_input"><span class="actAsPara">E-Mail or username</span></label></span>
</div>
<div class="fld-grp clearfix grpelem" id="widgetu63900" data-required="true" data-type="email"><!-- none box -->
<span class="fld-input NoWrap actAsDiv rounded-corners clearfix grpelem" id="u63901-4"><!-- content --><input class="wrapped-input" type="password" spellcheck="false" id="widgetu63900_input" name="password" tabindex="2"/><label class="wrapped-input fld-prompt" id="widgetu63900_prompt" for="widgetu63900_input"><span class="actAsPara">Password</span></label></span>
</div>
<button class="submit-btn NoWrap rounded-corners clearfix grpelem" id="u63909-4" data-muse-uid="U63909" data-muse-type="txt_frame" type="submit" value="Login" tabindex="3"><!-- content -->
<div style="margin-top:-12px;height:12px;">
<p>Login</p>
</div>
</button>
</form>因此,为了测试login_script.php是否被执行,我让它向我自己发送了一封电子邮件,它起作用了。但是,如果我想从login_script.php重定向,它不起作用。我已经从login_script.php中删除了重定向的所有代码。
我试过用
<?php
if ($_SERVER['REQUEST_METHOD'] == 'POST')
{
echo "<script type='text/javascript'>window.location.href = 'index.html';
}
?>以及
<?php
if ($_SERVER['REQUEST_METHOD'] == 'POST')
{
header('location:index.html');
}
?>我不知道我还可以尝试解决这个问题
发布于 2018-03-08 19:13:39
您好,如果问题仍然存在,请留言
<?php
if ($_SERVER['REQUEST_METHOD'] == 'POST')
{
header('Location:http://google.co.in');
}
?>发布于 2018-03-08 21:12:53
function redirect($url)
{
if (strpos($url, '://') === false)
{
// Make URL absolute
$url = (isset($_SERVER['HTTPS']) && $_SERVER['HTTPS'] !== 'off' ? 'https' : 'http') . '://' . $_SERVER['HTTP_HOST'] . '/' . $url;
}
if (headers_sent())
{
// Send the redirect statement via JavaScript.
echo "<script>window.location.replace(\"$url\");</script>\n";
}
else
{
// Use the more efficient HTTP header for redirection.
header('Location: ' . $url);
}
exit;
}
redirect('index.php');另请参阅
发布于 2018-03-08 18:40:23
试着回声
if ($_SERVER['REQUEST_METHOD'] == 'POST')
{如果它起作用了,那么试试这个。
header('Location: http://www.example.com/');https://stackoverflow.com/questions/49171017
复制相似问题