It’s vb’s Sleep 100
c’s delay
means waiting for 100 milliseconds..
It’s vb’s Sleep 100
c’s delay
means waiting for 100 milliseconds..
<code>#js settimeout("test()","2000"); //2000毫秒后执行test()函数,只执行一次。 setinterval("test()","2000"); //每隔2000毫秒执行一次test()函数,执行无数次。 #php sleep() - 延缓执行 usleep() - 以指定的微秒数延迟执行</code>
js
<code> setTimeout(function(){},1000)</code>
php
<code>sleep(10);</code>
js
There is no delay function equivalent to what you said sleep
/delay
. Strictly speaking, except for delay, these two functions will 阻塞
current thread, wait for delay过了之后
Then continue to execute the following code
The setTimeout
and setInterval
answered by LS are both 不阻塞
for the current thread. They just set a timer in the background. After the setting is completed, the code after 立马继续执行
will be executed after the timer time is up. Corresponding code
php
Use sleep
/usleep
, the effect is the same as c
php uses sleep(1); wait for 1 second
I looked through the poster’s question record and advised him to give up this industry as soon as possible.