我想让 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模板网!
以编程方式将可下载文件添加到 Woocommerce 产品Add programmatically a downloadable file to Woocommerce products(以编程方式将可下载文件添加到 Woocommerce 产品)
获取今天 Woocommerce 中每种产品的总订单数Get today#39;s total orders count for each product in Woocommerce(获取今天 Woocommerce 中每种产品的总订单数)
在 WooCommerce 和电话字段验证问题中添加自定义注Add Custom registration fields in WooCommerce and phone field validation issue(在 WooCommerce 和电话字段验证问题中添加自定义注册字段
在 Woocommerce 简单产品中添加一个将更改价格的选Add a select field that will change price in Woocommerce simple products(在 Woocommerce 简单产品中添加一个将更改价格的选择字段)
在 WooCommerce 3 中将自定义列添加到管理产品列表Add custom columns to admin products list in WooCommerce 3(在 WooCommerce 3 中将自定义列添加到管理产品列表)
自定义结帐“下订单"按钮输出htmlCustomizing checkout quot;Place Orderquot; button output html(自定义结帐“下订单按钮输出html)