在PHP中是否有相应的设定时间? [英] Is there a set time out equivalent in php?

查看:61
本文介绍了在PHP中是否有相应的设定时间?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

PHP是否等同于在JavaScript中设置超时?

Is there a PHP equivalent to setting timeouts in JavaScript?

在JavaScript中,您可以使用设置超时功能在经过一定时间后执行代码。

In JavaScript you can execute code after certain time has elapsed using the set time out function.

是否可以在PHP中执行此操作?

Would it be possible to do this in PHP?

推荐答案

您可以使用 sleep() 功能:

You can use the sleep() function:

int sleep ( int $seconds )

// Delays the program execution for the given number of seconds. 

示例:

public function sleep(){
   sleep(1);
   return 'slept for 1 second';
}

这篇关于在PHP中是否有相应的设定时间?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆