"Online" About PHP timer related issues

Source: Internet
Author: User
"Online Help" about PHP timer issues
Novice Help About PHP timer issues:
I want to write a timer on PHP, but PHP does not seem to support this feature, on the Internet to check a lot of friends, but none of the methods,
I now want to through a dead loop to achieve, but also not, to help my eldest brother elder sister ...
 
  Ignore_user_abort (TRUE);

function Test () {
echo "Test Timer! ";
}

do{
Sleep (3);//
Test ();

?>
PHP


------Solution--------------------
What do you want to do?
------Solution--------------------
jquery delay bar, combined with Ajax.
------Solution--------------------
crontab/Scheduled Tasks
------Solution--------------------
References:
Novice Help About PHP timer issues:
I want to write a timer on PHP, but PHP does not seem to support this feature, on the Internet to check a lot of friends, but none of the methods,
I now want to through a dead loop to achieve, but also not, to help my eldest brother elder sister ...
PHP code?123456789101112

In fact your method is feasible value is not should use echo to express because PHP in the process of running the echo information is stored in the buffer before the program runs out and will not output so you do not see the effect
You can replace echo with a database operation statement, such as 5 seconds to add 1 data. Can you look at it again?
------Solution--------------------
And it's best not to add ignore_user_abort to the test. This will run in the background even though the browser will still continue to execute unless stopped from the process
------Solution--------------------
When the page is closed, the time will not be updated.
For example, if you have a 1-minute visit, a user with a time difference of more than 1 minutes from the current time is naturally not online.
------Solution--------------------
You can use Window.setinterval () and Ajax to constantly send data to a PHP file, or to request data.
------Solution--------------------
You can use recursive functions to implement this function.
  • Related Article

    Contact Us

    The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

    If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

    A Free Trial That Lets You Build Big!

    Start building with 50+ products and up to 12 months usage for Elastic Compute Service

    • Sales Support

      1 on 1 presale consultation

    • After-Sales Support

      24/7 Technical Support 6 Free Tickets per Quarter Faster Response

    • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.