加入收藏 | 设为首页 | 会员中心 | 我要投稿 李大同 (https://www.lidatong.com.cn/)- 科技、建站、经验、云计算、5G、大数据,站长网!
当前位置: 首页 > 站长学院 > PHP教程 > 正文

PHP:格式错误的标题

发布时间:2020-12-13 17:36:21 所属栏目:PHP教程 来源:网络整理
导读:有人可以解释这个 PHP代码有什么问题吗? ( PHP版本5.3.5) ?php header('Bad Request',true,400); exit; 我得到状态500而不是400.在apache错误日志我得到 malformed header from script. Bad header=Bad Request: listener.php 我在这里做错了什么?我误解了
有人可以解释这个 PHP代码有什么问题吗? ( PHP版本5.3.5)
<?php 
    header('Bad Request',true,400);
    exit;

我得到状态500而不是400.在apache错误日志我得到

malformed header from script. Bad header=Bad Request: listener.php

我在这里做错了什么?我误解了the docs吗?

你必须写:
header('HTTP/1.0 400 Bad Request',400);

(编辑:李大同)

【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容!

    推荐文章
      热点阅读