How can I handle a function?

Source: Internet
Author: User
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' '; Echo' "; Echo" "; // Echo""; Echo' '; Echo' "; Echo" "; Echo'
'; // $ Message = fgets ($ fd_temp); echo $ message [0]; echo "\ n"; echo $ I; echo''; Echo "delete message"; echo"
'; For ($ I = 1; $ I <$ len; $ I ++) {echo $ message [$ I];} 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.

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.