Echo 语句没有被正确刷新?

发布于 2024-11-26 04:58:45 字数 169 浏览 2 评论 0原文

我已经尝试调试这段代码几个小时了,但还没有取得任何进展。我的打印语句根本不起作用。另一个问题建议我flush(),但它不起作用。

echo 'this never prints';
flush();
flush();
flush();

任何帮助将不胜感激。

I've been trying to debug this code for hours now, but haven't been making any headway. My print statements are simply not working. Another question suggested I flush(), but it's not working.

echo 'this never prints';
flush();
flush();
flush();

Any help would be appreciated.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(3

摇划花蜜的午后 2024-12-03 04:58:45

我认为您已关闭 display_errors 指令。检查您的 php.ini 文件以查看是否属于这种情况。

您的代码有语法错误;您在 echo 语句后缺少一个分号。仅当 display_errors 打开时,才能在浏览器中看到任何语法错误。

php.net 上的显示错误:
http://www.php.net/manual/en /errorfunc.configuration.php#ini.display-errors

I think you have the display_errors directive off. Check your php.ini file to see if this is the case.

Your code has a syntax error; you are missing a semi-colon after the echo statement. Any syntax error can only be seen in the browser if display_errors is on.

php.net on display_errors:
http://www.php.net/manual/en/errorfunc.configuration.php#ini.display-errors

享受孤独 2024-12-03 04:58:45

如果您位于输出缓冲区内(可以使用 ob_get_level()>0 进行检查),则可以使用 ob_flush() 刷新内容。如果你想打破所有输出缓冲区,这是一个快速的单行代码来结束它们:

while(ob_get_level()>0) ob_end_flush();

如果你想放弃,可以使用ob_end_clean()而不是ob_end_flush()缓冲区。

If you are inside an outbut buffer, which you can check with ob_get_level()>0, you can flush contents with ob_flush(). If you want to break out of all outbut buffers, this is a quick oneliner to end them all:

while(ob_get_level()>0) ob_end_flush();

Possibly use ob_end_clean() instead of ob_end_flush() if you want to discard the buffer(s).

情未る 2024-12-03 04:58:45
<?php
echo "Hello Web!";
?>

在这个简单的脚本中,您可以看到 PHP 脚本中一些最常用的组件。首先,PHP 标签用于将实际的 PHP 内容与文件的其余部分分开。您可以通过添加以下一对来通知解释器您希望它执行您的命令:标准标签“”;短标签“”; ASP 标签“<% %>”;脚本标签“”。标准和脚本标签保证在任何配置下工作,另外两个需要在“php.ini”中启用

<?php
echo "Hello Web!";
?>

In this simple script you can see some of the most used components of a PHP script. First off, PHP tags are used to separate the actual PHP content from the rest of the file. You can inform the interpreter that you want it to execute your commands by adding a pair of these: standard tags ""; short tags ""; ASP tags "<% %>"; script tags " ". The standard and the script tags are guaranteed to work under any configuration, the other two need to be enabled in your "php.ini"

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文