PHP: How to hide/display chunks of HTML

前端 未结 4 1194
误落风尘
误落风尘 2021-02-06 09:18

I\'m hoping someone can help with this very newbie question. I\'ve just come from an ASP.Net environment where it was easy to hide or show chunks of HTML. For example: Different

4条回答
  •  灰色年华
    2021-02-06 09:37

    Considering PHP as an embedded language you should, in order to get better readability, use the specific language forms for the "templating".

    Instead of using echo you could just write the HTML outside the tags (never use which could be misleading).

    Also it is suggested to use if () : instead of if () {, for example:

    
        
            

    It is true

    References:

    • Alternative syntax

提交回复
热议问题