在Smarty tpl文件中使用PHP代码 [英] Using PHP code in Smarty tpl FIle

查看:154
本文介绍了在Smarty tpl文件中使用PHP代码的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我是smarty的新手,我想在模板文件i-e tpl文件中使用php代码.我看过文档并在Google上进行了搜索,但找不到如何使用php代码,他们说我们需要配置smarty以允许php执行,但找不到如何执行.

I am new to smarty and I want to use php code in template file i-e tpl file. I have seen the documentation and searched on google but could not find how to use php code they say we need to configure smarty to allow php execution but could not find how to do it.

在这方面请帮助我. 谢谢

Kindly help me in this regard. Thanks

推荐答案

像煮鸡蛋一样容易!

{php}echo "hello!"{/php}

自Smarty 3.1开始

Edit as of Smarty 3.1:

从Smarty 3.1开始,{php}标签仅可从 SmartyBC 使用.

来源: http://www.smarty.net/docs/en/language.function .php.tpl

这篇关于在Smarty tpl文件中使用PHP代码的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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