php - Display echo on the screen while executing PHP code
问题描述
I have the code below in PHP. I would like him to display echo while running PHP. But it only displays after the while ends. That is, after php finishes running
The intention is to show progress throughout the execution. I wanted the echo to be displayed at the end of each loop
<?php
$id_estado = 0;
while ($id_estado<5) {
echo "OK";
$id_estado++;
sleep(2);
}
解决方案
You will need to set up the output for buffering. Try to place the code before your while loop.
ob_implicit_flush(true);
ob_end_flush();
推荐阅读
- c# - 在程序运行时更改 wpf 样式
- java - Firestore ui 适配器错误 java.lang.NullPointerException: 'void com.firebase.ui.firestore.FirestoreRecyclerAdapter.startListening()
- json - 基于json结构的简单json操作
- google-chrome - 浏览器上的“运行时/跟踪”查看器
- python - Python PyQt5 - 向表中添加行
- html - 似乎无法让图像、文本等出现在我的垂直导航菜单旁边
- 3d - THREE.js Mesh 没有填充 BoxHelper
- angularjs - ui-router 不会路由到 $urlRouterProvider.otherwise 时启用 html5Mode
- git - Egit 更改未推送的提交
- php - 不断收到消息:使用 codeigniter 的未定义变量