PHP sleep() 函数
PHP 教程
· 2019-01-27 14:57:17
实例
延迟执行当前脚本 5 秒:
<?php
echo date('h:i:s') . "<br>";
//sleep for 5 seconds
sleep(5);
//start again
echo date('h:i:s');
?>
echo date('h:i:s') . "<br>";
//sleep for 5 seconds
sleep(5);
//start again
echo date('h:i:s');
?>
定义和用法
sleep() 函数延迟执行当前脚本若干秒。
注释:如果指定秒数是负数,该函数将抛出一个错误。
语法
sleep(seconds)
| 参数 | 描述 |
|---|---|
| seconds | 必需。规定延迟执行脚本的秒数。 |
技术细节
| 返回值: | 如果成功则返回 0,如果错误则返回 FALSE。 如果调用被信号中断,该函数返回一个非零值。在 Windows 平台上,该值将总是 192,表示 Windows API 中的 WAIT_IO_COMPLETION 常量的值。在其他平台上,返回值将是剩余的延迟秒数。 |
|---|---|
| PHP 版本: | 4+ |
| 更新日志: | 在 PHP 5.3.4 之前的版本,当在 Windows 平台上调用该函数,总是返回 NULL。 |
点击查看所有 PHP 教程 文章: https://www.codercto.com/courses/l/5.html
Hacking Growth
Sean Ellis、Morgan Brown / Crown Business / 2017-4-25 / USD 29.00
The definitive playbook by the pioneers of Growth Hacking, one of the hottest business methodologies in Silicon Valley and beyond. It seems hard to believe today, but there was a time when Airbnb w......一起来看看 《Hacking Growth》 这本书的介绍吧!