duan0714 2013-08-09 02:31
浏览 297
已采纳

修复“致命错误:调用未定义函数http_redirect()”

I'm a pretty new PHP programmer, and as I was trying to call the PHP http_redirect() function, this error came up:

Fatal error: Call to undefined function http_redirect() in D:\xampp1.8.3\htdocs\Bank\create.php on line 28

I called it just like they did in the examples on the php site like this:

http_redirect("show.php", array("status" => "new"), true, HTTP_REDIRECT_PERM);

I'm more familiar with header(), but I don't know how to send in an something similar to http_redirect()'s params (the array()). I've tried doing header("Location: show.php?status=new") but that doesn't work for me.

Could somebody help with this? Thanks.

  • 写回答

1条回答 默认 最新

  • doutangu4978 2013-09-30 08:17
    关注

    http_redirect is also sending the same headers for location like you tried, so you don't really need http_redirect

    1. Your error is http_redirect does not exist, so I think you don't have pecl_http installed like @vinodadhikary said
    2. If header("Location ...") is not working maybe your headers are already sent (you can check this with the function headers_sent

      • Example: if(!headers_sent()) header("Location http://YOURDOMAIN.abc/target.html");
    3. It is suggested to use absolute URLs for location header

    4. In a comment on php.net, Chrome doesn't perform a Location: instruction unless it gets a Status: first
    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论

报告相同问题?

悬赏问题

  • ¥15 metadata提取的PDF元数据,如何转换为一个Excel
  • ¥15 关于arduino编程toCharArray()函数的使用
  • ¥100 vc++混合CEF采用CLR方式编译报错
  • ¥15 coze 的插件输入飞书多维表格 app_token 后一直显示错误,如何解决?
  • ¥15 vite+vue3+plyr播放本地public文件夹下视频无法加载
  • ¥15 c#逐行读取txt文本,但是每一行里面数据之间空格数量不同
  • ¥50 如何openEuler 22.03上安装配置drbd
  • ¥20 ING91680C BLE5.3 芯片怎么实现串口收发数据
  • ¥15 无线连接树莓派,无法执行update,如何解决?(相关搜索:软件下载)
  • ¥15 Windows11, backspace, enter, space键失灵