是否有类似于PHP的setTimeout()(JavaScript)的函数? [英] Is there a function similar to setTimeout() (JavaScript) for PHP?
问题描述
这个问题有点说 - 是否有一个函数与 PHP 函数 setTimeout()一样用于 PHP ?我搜索了 php.net ,我似乎找不到任何...
The question sort of says it all - is there a function which does the same as the JavaScript function setTimeout() for PHP? I've searched php.net, and I can't seem to find any...
推荐答案
无法延迟执行当前脚本中的部分代码。这也没有多大意义,因为PHP脚本的处理完全在服务器端进行,你只会延迟脚本的整体执行。有 sleep()
但这只会暂停一段时间。
There is no way to delay execution of part of the code of in the current script. It wouldn't make much sense, either, as the processing of a PHP script takes place entirely on server side and you would just delay the overall execution of the script. There is sleep()
but that will simply halt the process for a certain time.
你当然可以,安排PHP脚本使用cron作业等在特定时间运行。
You can, of course, schedule a PHP script to run at a specific time using cron jobs and the like.
这篇关于是否有类似于PHP的setTimeout()(JavaScript)的函数?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!