Is there a set time out equivalent in php?

后端 未结 4 1020
不思量自难忘°
不思量自难忘° 2020-12-20 16:09

Is there a PHP equivalent to setting timeouts in JavaScript?

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

4条回答
  •  猫巷女王i
    2020-12-20 16:58

    You can use the sleep() function:

    int sleep ( int $seconds )
    
    // Delays the program execution for the given number of seconds. 
    

    Example:

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

提交回复
热议问题