Summary on the implementation of partial page refreshing in PHP

Source: Internet
Author: User
This article provides a detailed analysis of the implementation of the PHP page partial refresh function. Many methods are required for reference. Iframe is commonly used in the past. Now there is more ajax, So ajax is usually used.
The first method is ajax implementation:
Of course, ajax can be implemented easily, but there is a lot of knowledge in it. I used ajax to automatically refresh the page time. The complete code is:
1. getTime. php:
The code is as follows:
Header ("cache-control: no-cache, must-revalidate ");
Header ("Content-Type: text/html; charset = utf-8 ");
$ Time = "18:00:00 ";
$ Dt_element = explode ("", $ time );
$ Date_element = explode ("-", $ dt_element [0]);
$ Time_element = explode (":", $ dt_element [1]);
$ Date = mktime ($ time_element [0], $ time_element [1], $ time_element [2], $ date_element [1], $ date_element [2], $ date_element [0]);
$ NowTime = time ();
$ Showtime = date ("Beijing Time, Y, m, d, H: I: s", $ date-$ nowTime );
If ($ showtime <= "January 01, 1970 08:00:00 Beijing time "){
Echo "happy new year ";
}
Echo $ showtime;

2. zidong. php:
The code is as follows:


Ajax dynamic display time

Current time:



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.