搜课云网 > 东莞达内 > 资讯总汇 > PHP中sleep和unsleep的用法

PHP中sleep和unsleep的用法

机构:东莞达内 时间:2016-08-29 10:50:46 点击:1096

  当你需要程序暂停执行几秒可以用 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参数是微秒,且无返回值。

  更多资讯,请访问东莞PHP培训学校

师资介绍