For example, the result you want to achieve is the data that has been changed in the background, and the data that is being modified in the foreground is also displayed as the question. The result you want to achieve is the data that has been changed in the background, the previous table also shows that this data item is being modified.
Reply content:
For example, if you want to achieve the effect of which data is changed in the background, the data is also being modified in the front.
$ Table_name = 'user'; echo 'is creating a data table:'. $ table_name; // action code $ result = $ flag? 'Success': 'failed'; echo 'data table '. $ table_name. 'create'. $ result;
Because PHP is executed in sequence, the output is fine if it is executed.
This mainly involvesStr_repeat () and flush ()
Two Functions and browser buffer size.
Different browsers have different buffer sizes and different str_repeat values. Note only this detail.
This is a bit difficult. You can judge the time when the page comes in. In addition, each time the data is modified, it is recorded to the database. Then compare the two time points. If they are similar, the data is displayed as being modified. This may be relatively simple. Of course there are many implementation schemes.
Main technologies: php ob Cache principles
PHP cache mechanism-OB Cache
You can refer to the onethink installation code:
Function create_tables ($ db, $ prefix = '') {// read the SQL File $ SQL = file_get_contents (MODULE_PATH. 'Data/install. SQL '); $ SQL = str_replace ("\ r", "\ n", $ SQL); $ SQL = explode ("; \ n", $ SQL ); // Replace the table prefix $ orginal = 'youyu _ '; $ SQL = str_replace ("' {$ orginal}", "'{$ prefix}", $ SQL ); // start to install show_msg ('start to install the database... '); foreach ($ SQL as $ value) {$ value = trim ($ value); if (empty ($ value) continue; if (substr ($ value, 0, 12) = = 'Create table') {$ name = preg_replace ("/^ CREATE table' (\ w + )'. */s "," \ 1 ", $ value); $ msg =" Create a data table {$ name} "; if (false! ==$ Db-> execute ($ value) {show_msg ($ msg. '... succeeded');} else {show_msg ($ msg. '... failed! ', 'Error'); session ('error', true) ;}} else {$ db-> ($ value) ;}} function show_msg ($ msg, $ class = '') {echo"