What is the best way to insert HTML via PHP?

前端 未结 11 2141
南方客
南方客 2020-12-12 15:26

Talking from a \'best practice\' point of view, what do you think is the best way to insert HTML using PHP. For the moment I use one of the following methods (mostly the lat

11条回答
  •  悲哀的现实
    2020-12-12 16:16

    For a very simple case like this, it is fine to use PHP as a template. However, if you go beyond simple logic (and you most likely will), it is a good idea to use template engines.

    In Zend Framework, which uses PHP view scripts by default, the recommended way to do this would be like this:

    
        [MARKUP HERE]
    
        [SOME MORE MARKUP]
    
    

    The more verbose syntax makes it a lot easier to match conditional blocks in a glance than using braces.

提交回复
热议问题