[英]Redirect after successful registration
I have a registration wherein if successful it would redirect to a certain page. 我有一个注册,如果注册成功,它将重定向到某个页面。 I'm having problem when a successful registration happens it would redirect to successReg.php my registration has a link that myurl/mobile/registration.php it should redirect to myurl/successReg.php instead what happens is it redirects to myurl/mobile/successReg.php which doesn't exist.
我在成功注册时遇到问题,它将重定向到successReg.php,我的注册有一个链接,该链接应将myurl / mobile / registration.php重定向到myurl / successReg.php,相反,它将重定向到myurl / mobile / successReg.php不存在。 So how can I make it to redirect at myurl/successReg.php?
那么,如何使它重定向到myurl / successReg.php?
Here is how I redirect when the registration is a success. 这是注册成功后如何重定向的方法。
echo ("<SCRIPT LANGUAGE='JavaScript'>
window.location.href='successReg.php';
</SCRIPT>");
Your main problem is that you specified a relative path. 您的主要问题是您指定了相对路径。 If your document root is myurl/ then Ben's solution is just fine, otherwise you should give the full path from your document root (like myurl/successReg.php).
如果您的文档根目录是myurl /,那么Ben的解决方案就可以了,否则,您应该提供文档根目录的完整路径(例如myurl / successReg.php)。
If you want to accomplish this with javascript you can do: 如果您想使用javascript完成此操作,则可以执行以下操作:
window.location = '/successReg.php';
If you redirect with javascript without the starting / it's always relative to the current uri, so in you case it redirects to myurl/mobile/successReg.php if you are redirecting from myurl/mobile. 如果您使用javascript重定向而没有开始/总是相对于当前uri,那么如果您是从myurl / mobile重定向,则它会重定向到myurl / mobile / successReg.php。
Check this for an article about relative and absolute paths: http://www.coffeecup.com/help/articles/absolute-vs-relative-pathslinks/ 在此查看有关相对和绝对路径的文章: http : //www.coffeecup.com/help/articles/absolute-vs-relative-pathslinks/
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.