how to call a function in PHP after 10 seconds of the page load (Not using HTML)

后端 未结 12 973
终归单人心
终归单人心 2020-12-11 02:44

Is there any way to call a function 10 seconds after the page load in PHP. (Not using HTML.)

12条回答
  •  南笙
    南笙 (楼主)
    2020-12-11 03:17

    If you really must do it within the same PHP script, the cleanest way would be a fork.

    Or if that's not possible, here's a really bad hackish way of doing it:

    
    

    If you're doing this to output stuff to the user after a delay, the above can be made to work but it's a really ugly way of doing it. Just use AJAX instead.

提交回复
热议问题