本文介紹了睡前PHP輸出文本的處理方法,對大家解決問題具有一定的參考價值,需要的朋友們下面隨著小編來一起學習吧!
問題描述
限時送ChatGPT賬號..
我想讓 PHP 輸出一些文本,然后休眠一秒半,然后再輸出一些文本.
I want PHP to output some text, then sleep for a second and a half, and then output some more text.
<?php
echo 'Output one.';
usleep(1500000);
echo 'Output two.';
?>
我的問題是所有文本都被同時輸出 - 等了 1.5 秒之后.我讀過一些關于一個叫做flush的函數——但它似乎不起作用.也許我沒有使用它寫.任何幫助將不勝感激^^
My problem is that all text is being put out simultaneously - after having waited those 1.5 seconds. I have read something about a function called flush - but it doesn't seem to work. Maybe I'm not using it write. Any help would be appreciated ^^
提前致謝!
推薦答案
看看這個
<?php
ob_start();
echo 'Output one.';
ob_flush();
usleep(1500000);
echo 'Output two.';
ob_flush();
?>
這篇關于睡前PHP輸出文本的文章就介紹到這了,希望我們推薦的答案對大家有所幫助,也希望大家多多支持html5模板網!
【網站聲明】本站部分內容來源于互聯網,旨在幫助大家更快的解決問題,如果有圖片或者內容侵犯了您的權益,請聯系我們刪除處理,感謝您的支持!