liujun595027165 2013-11-18 14:23 采纳率: 0%
浏览 5404

php ci框架中header()页面跳转问题

使用header函数跳转的时候可以找到指定的url 也能找到页面,但是页面就是不跳转,url不变,这是怎么回事
Request URL:http://localhost/login
Request Method:POST
Status Code:302
Request Headersview source
Accept:*/*
Accept-Encoding:gzip,deflate,sdch
Accept-Language:zh-CN,zh;q=0.8
Connection:keep-alive
Content-Length:67
Content-Type:application/x-www-form-urlencoded
Cookie:PHPSESSID=2k3ap23pdn68ecls5a1kgb8431
Host:localhost
Origin:http://localhost
Referer:http://localhost/
User-Agent:Mozilla/5.0 (Windows NT 6.1) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/29.0.1547.66 Safari/537.36
X-Requested-With:XMLHttpRequest
Form Dataview sourceview URL encoded
username:123
password:e10adc3949ba59abbe56e057f20f883e
role:student
这个是开始的原页面

Request URL:http://localhost/student/index
Request Method:GET
Status Code:200 OK
Request Headersview source
Accept:*/*
Accept-Encoding:gzip,deflate,sdch
Accept-Language:zh-CN,zh;q=0.8
Connection:keep-alive
Cookie:PHPSESSID=2k3ap23pdn68ecls5a1kgb8431
Host:localhost
Referer:http://localhost/
User-Agent:Mozilla/5.0 (Windows NT 6.1) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/29.0.1547.66 Safari/537.36
X-Requested-With:XMLHttpRequest
Response Headersview source
Connection:Keep-Alive
Content-Length:856
Content-Type:text/html
Date:Mon, 18 Nov 2013 14:22:30 GMT
Keep-Alive:timeout=5, max=99
Server:Apache/2.4.4 (Win32) PHP/5.4.16
X-Powered-By:PHP/5.4.16
这个是要跳转到的页面

  • 写回答

1条回答 默认 最新

  • ChatGPTᴼᴾᴱᴺᴬᴵ 2023-12-09 19:19
    关注

    所有内容均由人工智能模型输出,其内容的准确性和完整性无法保证,不代表我的态度或观点。
    (讯飞星火专栏,V3.0版本,2023.10.24)


    该回答引用讯飞星火认知大模型,仅提供参考,不保证完全正确
    这个问题可能是由于在header()函数中没有设置正确的HTTP状态码导致的。你可以尝试在header()函数中添加一个状态码,例如:

    header('Location: http://localhost/student/index', true, 302);
    

    这将设置HTTP状态码为302,并使用Location头将用户重定向到指定的URL。

    评论

报告相同问题?

悬赏问题

  • ¥15 LiBeAs的带隙等于0.997eV,计算阴离子的N和P
  • ¥15 关于#windows#的问题:怎么用WIN 11系统的电脑 克隆WIN NT3.51-4.0系统的硬盘
  • ¥15 matlab有关常微分方程的问题求解决,来真人,不要ai!
  • ¥15 perl MISA分析p3_in脚本出错
  • ¥15 k8s部署jupyterlab,jupyterlab保存不了文件
  • ¥15 ubuntu虚拟机打包apk错误
  • ¥199 rust编程架构设计的方案 有偿
  • ¥15 回答4f系统的像差计算
  • ¥15 java如何提取出pdf里的文字?
  • ¥100 求三轴之间相互配合画圆以及直线的算法