[Online help] Questions about php timers for beginners about php timers:
I want to write a timer in php, but php does not seem to support this function. I checked a lot of methods on the Internet, but none of them work,
I want to implement it through an endless loop, but it doesn't work either. ask for help...
Reply to discussion (solution)
What do you want?
What do you want? I want to get a session value on the page through php. if the page is closed or the session value becomes invalid, execute an SQL statement to modify the logon status of the current user.
Unfortunately, php does not have a timer.
Unfortunately, php does not have a timer. Yes, I know that php does not have a timer, so I want to implement it in other ways.
That is: knowing that it cannot be done for it ,?!?
There is no difficulty in the world, just afraid of people with heart
Php generally uses linux cron for timed batch.
Jquery latency, combined with ajax.
Crontab/scheduled task
Questions about the php timer:
I want to write a timer in php, but php does not seem to support this function. I checked a lot of methods on the Internet, but none of them work,
I want to implement it through an endless loop, but it doesn't work either. ask for help...
PHP code? 123456789101112 In fact, your method is feasible. The value should not be echo, because the echo information stored in the buffer during PHP running is not output before the program runs, so you cannot see the effect.
You can replace echo with a database operation statement, for example, adding 1 piece of data in less than 5 seconds.
In addition, it is recommended that you do not add ignore_user_abort during testing. this operation will run in the background, even if the browser is closed, the execution will continue unless it is stopped from the process.
Reference the landlord fff32165 reply: novice help questions about the php timer:
I want to write a timer in php, but php does not seem to support this function. I checked a lot of methods on the Internet, but none of them work,
I want to implement it through an endless loop, but it doesn't work either. ask for help...
PHP code? 123456789101112 I changed echo "test timer" to echo"