Using PHP as a template engine

后端 未结 6 2195
梦毁少年i
梦毁少年i 2020-12-02 00:57

I am not going to argue about the choice of a template engine against only PHP. I choose not to use a template engine, like Smarty, because I would like to learn how to prop

6条回答
  •  情书的邮戳
    2020-12-02 01:14

    I've used various template engines, and designed my own as well, getting more elaborate over time. I think its best to keep it as simple as possible by using native php stuff, instead of creating elaborate functions. (this article has some good points: Boring Architecture is Good). What I found was much better readability and maintenance when coming back to a project after months or years.

    For example:

    -- templates/unsubscribe.php --

    
     
    
    EOHTML;
    echo $o;
    

提交回复
热议问题