sleep,usleep

当你需要程序暂停执行几秒可以用 sleep
 int sleep ( int $seconds ) 程序暂停$seconds秒后执行。

 Returns zero on success, or FALSE on error.成功返回0,错误返回false。

 If the call was interrupted by a signal, sleep() returns a non-zero value. On Windows, this value will always be 192 (the value of the WAIT_IO_COMPLETION constant within the Windows API). On other platforms, the return value will be the number of seconds left to sleep.

 如果调用被信号中断,该函数返回一个非0值。在windows平台上,这个值总是192(这个值是Windows API中等待IO完成WAIT_IO_COMPLETION的常量值)。其它平台返回值为sleep还没有执行的秒数。

 

If the specified number of seconds is negative, this function will generate a E_WARNING.

如果参数为负值,则函数生产一个警告错误.

当你需要程序暂停执行1秒以下时间的时候你可以用usleep

void usleep ( int $micro_seconds )

Delays program execution for the given number of micro seconds.

usleep参数是微秒,且无返回值。

当你需要程序执行单位更小(小于微秒)可以用

 time_nanosleep() - Delay for a number of seconds and nanoseconds

如果你希望程序暂停执行到某个时间点,你可以用

time_sleep_until()- Make the script sleep until the specified time

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值