php - 使用路由器重定向登录
问题描述
登录后我无法重定向到我的主页
我的结构:
views/auth/login.php <-- Thats my Login Page
public/index.php/ <-- router
https://sub.mydomain.de/auth/login <-- login url
https://sub.mydomain.de/ <-- url after Login
如果登录有效,我想将用户重定向到此页面https://sub.mydomain.de/
我试过了:
header("/../../../public/index.php")
解决方案
Location
一切都很好,但这里缺少一件事header()
;
`header("Location: /../../../public/index.php");`
您必须在标题中定义位置!
学习PHP一些令人兴奋的东西的最佳场所。
快乐编码!
推荐阅读
- python - Sqlite在Python中查询整数值字段不起作用
- java - JSON 响应值表示 Null 放心
- python - 以字典的形式存储文件中的数据(可能是+熊猫)
- c# - 如何访问元组的索引值?
- spring-boot - Spring Controller 返回 blob 性能不佳
- sql - 获取第一个可用的日期(最大日期)加入基于日期排列的 ASC 表
- java - 如何修复我的数组,以免出现 IndexOutOfBoundsException?
- python - 剩余项目的所有可能组合
- reactjs - 如何更改类型或 React 组件?
- css - 是否可以从子元素访问父元素的 CSS 计数器值?