Home  >  Article  >  Backend Development  >  PHP scheduled update program design ideas sharing_PHP tutorial

PHP scheduled update program design ideas sharing_PHP tutorial

WBOY
WBOYOriginal
2016-07-13 10:28:39830browse

Looking back now, my previous idea was wrong. The execution process of the web page

Open WEB page —- Load HTML code (including CSS, javascript) — Execute PHP code — Complete

Let’s roughly understand it as above.

We all know that PHP is a server-side script, which has a timeout setting, which can be processed through the set_time_limit() function. But this way of handling PHP code is very

Consumption of CPU resources. So it is not recommended to loop through PHP code.

Generally, it is handled with javascript.

Copy code The code is as follows:

$(function(){
var tims = 1000*60*60* 10; //Set the delay processing time. The setting here is 10 hours
setInterval(function(){
//The code to be executed
$.post("./data.php", {postdata}, function (datas) {
if (id.data == 1)
{
$ ("body").
         }
      });
}, tims);
The above is the javascript code to be executed by the WEB frontend, which achieves automatic processing by delaying the execution of ajax
The php background processing code is simple, just accept the data POST from the front desk. The data is then processed and stored in the database.

It’s that simple, but the page cannot be closed. You can understand this as the background program of the software.

In fact, a software is divided into: front-end, back-end, and server-side. Both the front-end and back-end run on your computer.

Tencent software background program

The background program can only be monitored through the task manager, but what does it do? You have no idea.

Only 360 can steal your privacy like a "worker bee", and only QQ can obtain cookies.


Not much to say, this is a kind of software design pattern, just understand it.

http://www.bkjia.com/PHPjc/781408.html

www.bkjia.com

http: //www.bkjia.com/PHPjc/781408.htmlTechArticleLooking back now, my previous idea was wrong. The execution process of the web page opens the WEB page - loading the HTML code (Including CSS, javascript) - Execute PHP code - Complete the rough approximation...
Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn