[英]Conditional redirect is not working, how to redirect on successful registration?
[英]Redirect after successful registration
我有一個注冊,如果注冊成功,它將重定向到某個頁面。 我在成功注冊時遇到問題,它將重定向到successReg.php,我的注冊有一個鏈接,該鏈接應將myurl / mobile / registration.php重定向到myurl / successReg.php,相反,它將重定向到myurl / mobile / successReg.php不存在。 那么,如何使它重定向到myurl / successReg.php?
這是注冊成功后如何重定向的方法。
echo ("<SCRIPT LANGUAGE='JavaScript'>
window.location.href='successReg.php';
</SCRIPT>");
您的主要問題是您指定了相對路徑。 如果您的文檔根目錄是myurl /,那么Ben的解決方案就可以了,否則,您應該提供文檔根目錄的完整路徑(例如myurl / successReg.php)。
如果您想使用javascript完成此操作,則可以執行以下操作:
window.location = '/successReg.php';
如果您使用javascript重定向而沒有開始/總是相對於當前uri,那么如果您是從myurl / mobile重定向,則它會重定向到myurl / mobile / successReg.php。
在此查看有關相對和絕對路徑的文章: http : //www.coffeecup.com/help/articles/absolute-vs-relative-pathslinks/
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.