加入收藏 | 设为首页 | 会员中心 | 我要投稿 李大同 (https://www.lidatong.com.cn/)- 科技、建站、经验、云计算、5G、大数据,站长网!
当前位置: 首页 > 站长学院 > PHP教程 > 正文

Smarty安装配置方法

发布时间:2020-12-13 05:23:58 所属栏目:PHP教程 来源:网络整理
导读:下载最新的Smarty:http://smarty.php.net/ 当前最新版本:2.6.18 解压后将目录中的libs目录重命名为smarty,复制到你的网站目录,同时在网站根目录下建立templates和templates_c两个目录 建立test.php,内容如下: ?php include_once('./Smarty/Smarty.clas

下载最新的Smarty:http://smarty.php.net/
当前最新版本:2.6.18
解压后将目录中的libs目录重命名为smarty,复制到你的网站目录,同时在网站根目录下建立templates和templates_c两个目录
建立test.php,内容如下:
<?php
include_once('./Smarty/Smarty.class.php');$smarty=newSmarty();
$smarty->template_dir="./templates";//模板存放目录
$smarty->compile_dir="./templates_c";//编译目录
$smarty->left_delimiter="{{";//左定界符
$smarty->right_delimiter="}}";//右定界符
$smarty->assign('test','OK');
$smarty->display('test.html');
?>
给templates_c权限755 在templates目录下新建test.html:




{{$test}}


打开test.php,如果看到OK就说明你的smarty安装成功了!

(编辑:李大同)

【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容!

    推荐文章
      热点阅读