gpt4 book ai didi

php - 查询后在 WordPress 中重定向?

转载 作者:行者123 更新时间:2023-11-29 23:17:28 24 4
gpt4 key购买 nike

在 WordPress 中,提交表单后,我尝试重定向到另一个页面,但无法执行以下操作:

if(isset($_POST['name']))
{
$q=mysql_query("INSERT INTO `contactsus` (name, email, location, mobile, subject, comment, created) VALUES('$name', '$email', '$location', '$mobile', '$subjct', '$comment', '".time()."') ");
if($q)
{
echo '{"responce":"1","message":"Thanks for the registration","url":"'.$_SESSION['SITE_URL'].student.'"}';
}
else
{
echo '{"responce":"0","message":"Your registration request has been failed due to system error"}';
}
}

这段代码的结果是:

{
"responce":"1",
"message":"Thanks for the registration",
"url":"http://localhost/manishatutors/student"
}

最佳答案

为此,您可以使用 wp_safe-redirect WordPress 的函数,它使用 wp_redirect() 执行安全(本地)重定向。

关于php - 查询后在 WordPress 中重定向?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/27644877/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com