简体   繁体   中英

PHP: How to respond with a custom protocol other than HTTP?

My application is served by php-fpm so PHP will detect that and try to format the response to make it a valid HTTP response. I want to change that:

<?php
ini_set('html_errors', 0);
$x = "<body></body>";
header_remove('Content-type');
echo $x;

The current output (Not what I want):

CRLF (empty line)
<body></body>

I want to have a full control over php response and remove empty line at the beginning:

<body></body>

How can I do it? How can I have a full control over the output in FastCGI environment.

You cannot remove the newline between the header and the response body.

They are hardcoded in the FPM engine:

If you don't want the newline, put something in front of the FPM that modifies the response before returning it to the requesting client.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM