开发者

PHP: Malformed header

开发者 https://www.devze.com 2023-03-08 02:16 出处:网络
Could someone explain what is wrong with this PHP code? (PHP Version 5.3.5) <?php header(\'Bad Request\', true, 400);

Could someone explain what is wrong with this PHP code? (PHP Version 5.3.5)

<?php 
    header('Bad Request', true, 400);
    exit;

I get a status 开发者_C百科500 instead of 400. And in the apache error log I get

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

What am I doing wrong here? Have I misunderstood the docs?


you have to write:

header('HTTP/1.0 400 Bad Request', true, 400);
0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号