dongzouche9108 2013-06-15 04:04
浏览 31

当您运行PHP调试器并逐步执行回显时,是否应该动态更新浏览器输出?

I have a PHP file with the following contents:

1. <?php
2. $string = 'Hello world!';
3. echo $string;
4. ?>

I put a break on line 2 and line 4. I run the debugger. The browser output opens, the script has halted on line 2, and the browser output is empty. Makes sense! Then I jump to the next breakpoint at line 4, after the echo command. AT THIS POINT, should the browser update and display 'Hello world'? Or do debuggers not update the browser output step-by-step, and thus are NOT useful for browser display and are only useful for inspecting the inner-code itself?

Thank you!

  • 写回答

1条回答 默认 最新

  • dongzong1866 2013-06-23 09:24
    关注

    The answer is a bit complicated here. In general, Xdebug will not stop output to the browser, and PHP will not do so either unless you have output buffering or automatic compression turned on.

    However, the web server might buffer data up to a certain point before it sends it onwards to the browser. You can force the web server to flush its buffers by calling flush(): http://php.net/flush. Be aware though that some browsers, also wait until they have had enough data to actually show anything.

    评论

报告相同问题?

悬赏问题

  • ¥15 2024-五一综合模拟赛
  • ¥15 如何将下列的“无限压缩存储器”设计出来
  • ¥15 下图接收小电路,谁知道原理
  • ¥15 装 pytorch 的时候出了好多问题,遇到这种情况怎么处理?
  • ¥20 IOS游览器某宝手机网页版自动立即购买JavaScript脚本
  • ¥15 手机接入宽带网线,如何释放宽带全部速度
  • ¥30 关于#r语言#的问题:如何对R语言中mfgarch包中构建的garch-midas模型进行样本内长期波动率预测和样本外长期波动率预测
  • ¥15 ETLCloud 处理json多层级问题
  • ¥15 matlab中使用gurobi时报错
  • ¥15 这个主板怎么能扩出一两个sata口