Joke Collection Website - Public benefit messages - Who can help analyze this PHP code? Try to write in detail. I'm a beginner and don't know much about it. Thank you.

Who can help analyze this PHP code? Try to write in detail. I'm a beginner and don't know much about it. Thank you.

I wonder if the order of the pictures I see here is the same as yours. I'll explain it to you in this order.

The content in the first picture is mainly php. First of all, "if" judges whether the request submitted on this page is submitted in post mode, that is, the data to be submitted in the form of your second picture. If you are in post mode, execute the code block in if and execute a function, that is, the test_input function under your if{}, it will remove the left and right spaces of the value you passed to it, such as "? I am a value? " Change it to "I am a value", and then pass this value to the place called in your if to provide assignment.

The content in the second picture, mainly the html part, is written as a form < form & gt& lt/form & gt;; Among them, the mthod attribute specifies that the submission method of the form is post and the action attribute is the submission address. If it is empty, submit it to this page, which is the place shown in figure 1

The third picture is the content of php, and echo means printout, which prints out many processed variables in the picture 1