也许我会以错误的方式解决这个问题,但我会列出我希望我的网站执行的过程,然后看看你们可以想到的解决方案.
在URL
example.net/ShellySite/Form/form.php
Run Code Online (Sandbox Code Playgroud)
有一个表格要填写,然后按下提交按钮,网站就会到
example.net/ShellySite/Controller/PHP/submitform.php
Run Code Online (Sandbox Code Playgroud)
它在这里因为它将表单中的详细信息提交给数据库,我想做的事情基本上是在submitform.php页面的代码运行完毕后立即将浏览器重新路由到不同的页面,类似于
example.net/ShellySite/Home/home.php
Run Code Online (Sandbox Code Playgroud)
但我似乎无法让它发挥作用.我尝试了类似的东西,header(Location:"example.net/ShellySite/Home/home.php")
但它只是将所有这些添加到最后example.net/ShellySite/Controller/PHP/submitform.php,这显然不是我想要的.
任何帮助都会很棒!
使用绝对URL:
header('Location: http://example.net/ShellySite/Home/home.php');
Run Code Online (Sandbox Code Playgroud)