开发者

PHP output buffer is not empty?

开发者 https://www.devze.com 2023-04-07 01:39 出处:网络
I have this peculiar problem. I am making an AJAX call to a PHP page. In case of error I am returning the string \"error\" to success: function(msg) i.e. msg will have the value \"error\". But for som

I have this peculiar problem. I am making an AJAX call to a PHP page. In case of error I am returning the string "error" to success: function(msg) i.e. msg will have the value "error". But for some reason it is sending back "error" but with a line break preceding it. And this fails the condition when i check if (msg=="error"). I have to put ob_clean() to clear out the output buffer. Then it returns "error" without line break. I che开发者_JAVA百科cked but my PHP function is not outputting anything before the "error". What can be the issue that the output buffer is not empty?


That happens because some of your php files has an empty line before <?php or after ?>

As PhpMyCoder propsed - you could also not put ?> in the end of the file at all. Php allows doing that.

0

精彩评论

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

关注公众号