I’m trying to implement a simple service in PHP. The service needs to return strings to certain requests. However, when I try to echo the string, PHP somehow adds
to the beginning of the string. I am using echo
to output the response.
I tried to echo one space character:
$test = ' ';
echo $test;
and in the response I still got '
'
.
I have tried header('Content-type: text');
and $string = preg_replace("
", "", $string);
, but I’m still getting the new line in the response.
I’m new to PHP, so if this is some kind of concept, could someone provide me with pointers to information where I can read about it?
question from:
https://stackoverflow.com/questions/30709964/why-does-php-add-r-n-to-an-empty-string 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…