See a function PHPcodefunctionlistlist (& amp; $ num) {if (1 $ page) $ num_last1; else $ num_last $ num-100 + 1; $ file_name & quot; data & quot ;; $ real_num0; for (; $ shows a function
PHP code
Function listlist (& $ num) {// if (1 = $ page) $ num_last = 1; // else $ num_last = $ num-100 + 1; $ file_name = "data"; $ real_num = 0; for (; $ real_num <= 100; $ num --) {$ file_temp = $ file_name. $ num. ". txt "; if (FALSE = file_exists ($ file_temp) continue; else {$ real_num ++; $ message = file ($ file_temp ); $ len = count ($ message); echo'
'; Echo'
'; Echo'
'; // $ Message = fgets ($ fd_temp); echo $ message [0]; echo "\ n"; echo $ I; echo' | '; Echo'
'; Echo "delete message"; echo" | "; Echo"
"; // Echo""; Echo'
'; Echo'
'; For ($ I = 1; $ I <$ len; $ I ++) {echo $ message [$ I];} echo" | "; Echo"
"; Echo'
';}}$ Num --;}
This function is to mix php and html, right?
Please enlighten me
------ Solution --------------------
I personally think it cannot be understood as "php and html are mixed together". php is the language on the server side. after the server completes execution, the result is displayed on the client side ~ The above code is just a piece of html that is directly displayed in the browser. It is only a result. how to use it depends on what the front-end wants to do.
------ Solution --------------------
The so-called "hybrid" means that the code is mixed together. this is generally not recommended. the landlord can refer to some template writing methods.
It is difficult to maintain the code after it is messy. it is not a habit to watch the egg once.
Discussion
I personally think it cannot be understood as "php and html are mixed together". php is the language on the server side. after the server completes execution, the result is displayed on the client side ~ The above code is just a piece of html that is directly displayed in the browser. It is only a result. how to use it depends on what the front-end wants to do.
------ Solution --------------------
Theoretically, the running result is a table, but it is best not to. html and php are separated.
------ Solution --------------------
The final result of php processing is either input to the database or disk file, or output to the browser.
------ Solution --------------------
Php and html code are mixed together. this is normal and there is nothing wrong with it.
Although it looks uncomfortable, it is troublesome to modify it. But this is necessary, because you need to embed dynamic content in HTML, and these dynamic content needs to be wrapped with HTML tags
Of course, you can use the template engine to separate PHP code from HTML code, but the final execution is still mixed code. It is only done by the template engine, not by you.