我可以在JS和PHP中使用哪种模板引擎? [英] Which templating engine can I use with both JS and PHP?

查看:277
本文介绍了我可以在JS和PHP中使用哪种模板引擎?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在寻找一个简单的模板引擎,它可以在客户端使用JS服务器端和PHP服务器。

I'm looking for a simple Template engine that works both on client side with JS ánd on server side with PHP.

这意味着我希望能够对两个用例使用相同的模板定义

That means I want to be able to use the same template definition for both use cases.

你知道任何在JS和PHP中都有官方实现的模板引擎吗?

Do you know any templating engines that have official implementations in both JS and PHP?

推荐答案

如果您喜欢 JS-> PHP优先级 :)那么您有两个jquery-tmpl兼容模板PHP后端的渲染器

If you like JS->PHP priority :) then you have this two jquery-tmpl compatible template renderer for PHP backend


  1. https://github.com/abackstrom/jquery-tmpl-php

  2. https://github.com/xyu/jquery-tmpl-php

  1. https://github.com/abackstrom/jquery-tmpl-php
  2. https://github.com/xyu/jquery-tmpl-php



<如果您更喜欢 PHP-> JS优先级 :)那么您可以尝试这个流行的PHP模板Smarty的Javascript实现

If you prefer more PHP->JS priority :) then you can try this Javascript implementation of popular PHP templating Smarty


  1. <小时ef =http://code.google.com/p/jsmart/ =noreferrer> http://code.google.com/p/jsmart/

  1. http://code.google.com/p/jsmart/

或者你可以尝试更中性的东西:

Or you can try something more neutral like:


  1. Moustache http://mustache.github.com/

  1. Mustache http://mustache.github.com/

这篇关于我可以在JS和PHP中使用哪种模板引擎?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆