Is there a set time out equivalent in php?

后端 未结 4 1018
不思量自难忘°
不思量自难忘° 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条回答
  •  心在旅途
    2020-12-20 16:55

    Without knowing a use-case for your question it's hard to answer it:

    • If you want to send additional data to the client a bit later you can do a JS timeout on the client side with a handler that will make a new HTTP request to PHP.
    • If you want to schedule some task for a later time you can store that in a database and poll the DB in regular intervalls. It's not the best peforming solution but relatively easy to implement.

提交回复
热议问题