V2EX = way to explore
V2EX 是一个关于分享和探索的地方
现在注册
已注册用户请  登录
assad
V2EX  ›  程序员

现在大家都习惯用哪个 PHP 模板引擎啊

  •  
  •   assad · 2016-06-28 14:13:10 +08:00 · 5491 次点击
    这是一个创建于 2851 天前的主题,其中的信息可能已经有所发展或是发生改变。

    据说 Smarty 已经不行了, Twig 感觉还是很挫,哪个比较好呢?

    27 条回复    2016-06-29 13:22:38 +08:00
    acoldfox
        1
    acoldfox  
       2016-06-28 14:32:54 +08:00
    volt
    easychen
        2
    easychen  
       2016-06-28 14:34:48 +08:00
    我用 PHP 的原生模板。话说 Twig 其实还算顺眼啊。
    Wangxf
        3
    Wangxf  
       2016-06-28 14:40:34 +08:00
    laravel 不是推荐 blade 么
    assad
        4
    assad  
    OP
       2016-06-28 14:41:34 +08:00
    @Wangxf 移植性感觉不好
    assad
        5
    assad  
    OP
       2016-06-28 14:42:00 +08:00
    @easychen 每次改完文件,必须强行删除 cache 才生效,所以感觉不好使
    Conte
        6
    Conte  
       2016-06-28 14:51:29 +08:00
    “据说 Smarty 已经不行了”,这个是因为啥?
    assad
        7
    assad  
    OP
       2016-06-28 14:52:25 +08:00
    @Conte 觉得性能低
    strwei
        8
    strwei  
       2016-06-28 16:03:15 +08:00
    PHP 的原生模板+1 ,性能极佳
    cxbig
        9
    cxbig  
       2016-06-28 16:09:48 +08:00
    现在流行 PHP 做 API ,传 json ,模板渲染交给 React 、 AngularJS 、 VueJS 之类的前端框架。
    sfree2005
        10
    sfree2005  
       2016-06-28 16:28:39 +08:00 via iPhone
    同意楼上。反正现在的不少 web app 都要有 mobile app , API 迟早要写。所以可以慢慢迁移到 angular react 之类。我目前是 Smarty 和 angular 混用,只是过渡方案。
    assad
        11
    assad  
    OP
       2016-06-28 16:39:38 +08:00
    @strwei 呵呵。可是前后端配合起来不是很友好!
    assad
        12
    assad  
    OP
       2016-06-28 16:40:44 +08:00
    @sfree2005 鄙人 JS 就是一坨屎,哎!
    shoaly
        13
    shoaly  
       2016-06-28 16:41:10 +08:00
    性能永远不再 这个模板层上.... 选个喜欢的 或者框架自带的就可以了
    likezun
        14
    likezun  
       2016-06-28 17:03:17 +08:00
    twig
    chaegumi
        15
    chaegumi  
       2016-06-28 17:56:26 +08:00
    codeigniter 原生的
    mcfog
        16
    mcfog  
       2016-06-28 18:01:16 +08:00
    php

    如果非要引用点什么的话,推荐看看 league/plates
    rwalle
        17
    rwalle  
       2016-06-28 19:12:48 +08:00
    我觉得这种帖子以后是不是可以去 /go/monthly
    breeswish
        18
    breeswish  
       2016-06-28 19:24:15 +08:00
    没遇到过比 twig 更好用的了
    volt 的 template inheritance 就是个摆设没啥用
    ------
    删 cache 是你没开 debug 模式吧
    Moker
        19
    Moker  
       2016-06-28 19:47:24 +08:00
    blade 写得很爽啊 phpstorm 也有提示
    或者 vuejs 交给前端去做也行
    assad
        20
    assad  
    OP
       2016-06-28 20:07:25 +08:00
    @breeswish 明白了,没好好看文档
    assad
        21
    assad  
    OP
       2016-06-28 20:07:42 +08:00
    @Moker 基本上不喜欢用 IDE ,感觉臃肿的很啊
    phithon
        22
    phithon  
       2016-06-28 20:46:28 +08:00
    因为常写 python 的缘故,必然是 twig
    ykjsw
        23
    ykjsw  
       2016-06-28 22:01:55 +08:00
    用 discuz 那个,轻便高效,我的几个项目都是用那个 www.jser.com 下面的所有页面, sns.net 还有这个
    techmoe
        24
    techmoe  
       2016-06-28 22:46:34 +08:00 via Android
    Smarty 王道
    dongyu
        25
    dongyu  
       2016-06-29 09:01:12 +08:00
    twig , blade 都不错
    assad
        26
    assad  
    OP
       2016-06-29 10:03:36 +08:00
    @ykjsw 呵呵,以前我也经常用
    hwsdien
        27
    hwsdien  
       2016-06-29 13:22:38 +08:00
    以前用过 twig, 觉得还可以
    关于   ·   帮助文档   ·   博客   ·   API   ·   FAQ   ·   我们的愿景   ·   实用小工具   ·   5387 人在线   最高记录 6543   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 31ms · UTC 08:09 · PVG 16:09 · LAX 01:09 · JFK 04:09
    Developed with CodeLauncher
    ♥ Do have faith in what you're doing.