The above code arrangement is standard, but I don’t know why the tp5 loop is completely messed up
It becomes the following
and are not displayed according to the correct indentation. Although the page is not affected, it is very confusing when viewing the source code.
First of all, what you write here is a template language. The TP background is to further convert it into PHP code and then execute it. During the process of converting PHP, the generated code is completely different from the code you see. There may be a lot more. Or less. Some spaces and so on are ignored, and some have extra spaces and line breaks.
So, the code given to the browser will become what you see, mainly because of the inconsistency between spaces and line breaks.
Finally, the source code is not for others to see, the code in your editor is. No matter how messy it is, the browser just needs to recognize it. You can look at some websites and all the HTML codes are squeezed together because they have been compressed. But it doesn't matter, so don't worry about it.