开发者

PHP flush function causing weird characters on the screen

开发者 https://www.devze.com 2023-01-20 02:19 出处:网络
After so much trouble I find out that when I use the flush function in my PHP mail script then I get garbage or dump characters on browser like below.

After so much trouble I find out that when I use the flush function in my PHP mail script then I get garbage or dump characters on browser like below.

PHP flush function causing weird characters on the screen

The code is below

if ($mail->Send()) {
    echo "<br><font color=darkgreen>[$num successful send to $to]</font> ";
    // flush();
    return true;
}

If I comment that flush line then out is simple English but I uncomme开发者_JAVA百科nt that the whole page the text looks like garbage.

Now is that a PHP problem, browser problem or server problem?

If I use the same script from the shell, I mean execute inside the shell terminal then I can see the HTML output. But it does not work in browsers.


I found the answer to my own question. I had to turn

zlib_compression off

in my php.ini settings file.

(What does that mean and why did it work?. I had been trying this for 1 year but could not resolve the problem but now it worked.)

0

精彩评论

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