在smarty文件夹下建立一个test文件夹,test下建立如下:

编辑test.php如下:

<?php
require('../smarty/Smarty.class.php');
$smarty = new Smarty();
//五配置
$smarty->left_delimiter = "{";
$smarty->right_delimiter = "}";
$smarty->template_dir ="tpl";
$smarty->compile_dir ="template_c";
$smarty->cache_dir ="cache";
//开启缓存的另两个配置
$smarty->caching =true;
$smarty->cache_lifetime =120; $smarty->assign('hello','你好');//赋值变量
$smarty->display('test.html');
?>

在tpl中建立test.html,输入{$hello}

在浏览器中测试test.php

成功输出“你好”

Smarty配置与实例化的更多相关文章

  1. Flask - app的配置和实例化Flask的参数

    目录 Flask - app的配置和实例化Flask的参数 app的配置 app的配置 Flask - app的配置和实例化Flask的参数 app的配置 基本用法: from flask impor ...

  2. testlink于smarty配置和使用

    于testlink于,采用smarty首先配置. 一般在过程化的编程中.创建一个smarty.inc.php的文件来配置Smarty的信息,其它文件引入就可以,目的是为了不改动smarty.class ...

  3. php smarty 配置四个存放目录

    require("Smarty.class.php"); $smarty = new Smarty(); $smarty -> template_dir = "./ ...

  4. 如何配置Smarty模板

    <?php //首先包含Smarty类文件 include_once('Smarty/Smarty.class.php'); //实例化Smarty类文件 $smarty=new Smarty( ...

  5. PHP中如何配置smarty框架实现PHP代码和HTML代码分离

    header('Cache-Control:Private');//保留用户填写的信息 session_start();//开启缓存 define('MYCMS','UTF-8');//定义网站编码常 ...

  6. php Smarty详细配置

    1.在Smarty官网下载 路径:https://github.com/smarty-php/smarty/releases 2.把下载下来的Smarty解压出来 3.把解压出来的Smarty里面的l ...

  7. CI 2.2 + smarty 3.1.18 完美整合配置成功

    CI 2.2 + smarty 3.1.18 配置成功 一.准备文档下载  (CI 框架和smarty) 二.将Smarty-3.1.18 源码包里面的libs文件夹copy到ci的项目目录appli ...

  8. smarty模板配置代码详细说明及如何注册自己的smarty函数

    下面为smarty模板的配置文件,smarty配置的详细说明以及如何注册自己所需要的smarty函数 config.inc.php <?php /** * Smarty 调用 * www.daf ...

  9. MVC架构学习之Smarty学习——病来而蔫

    前两天是五一小长假,而每次假期都想着如何如何刻苦一番,往往是自作多情.. 当然这次是有小病在身,多个借口吧. 一有病就蔫的不行...要锻炼了啊,脚估计也差不多了,游泳试试吧这周. 这次学习Smarty ...

随机推荐

  1. java代码----数据类型的转换-----int --->String

    总结:int ----->String package com.a.b; //测试..char--->int // int--->String public class Yue2 { ...

  2. hsqldb简单使用总结

      hsqldb数据库是一款纯Java实现的开源免费数据库,相对其他数据库来说,体积非常小,使用方便,非常利于在测试环境中使用,无需复杂的数据库配置.   hsqldb数据库引擎有几种服务器模式:Se ...

  3. hadoop集群调优-hadoop settings and MapReduce

    Hadoop Settings 由于Hadoop节点的系统配置,一些hadoop的设置可以减少运行系统中的瓶颈.首先,提高Java运行时的堆内存容量,也要和系统中的整体内存容量相关:其次,保持hado ...

  4. javaweb地图定位demo

    <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/stri ...

  5. Oracle重建临时表空间

    [oracle@hd58 ~]$ sqlplus / as sysdba SQL*Plus: Release 11.2.0.3.0 Production on Wed Jun 27 11:58:25  ...

  6. Java Ant Build详解

    转载地址:http://www.cnblogs.com/wufengxyz/archive/2011/11/24/2261797.html 1,什么是antant是构建工具2,什么是构建概念到处可查到 ...

  7. IE6中PNG图片背景无法透明显示的最佳解决方案

    我想,对于像我这样的年轻的程序员来说,做网页开发时用chrome.firefox或者ie10什么的大约是被宠坏了.所以当最近做的项目不得不在恐龙化石般的ie6上运行时,ie6种种诡异的行径简直让我发指 ...

  8. sort_region——对区域进行排序

    The operator sort_region sorts the regions with respect to their relative position. All sorting meth ...

  9. 「小程序JAVA实战」小程序头像图片上传(下)(45)

    转自:https://idig8.com/2018/09/09/xiaochengxujavashizhanxiaochengxutouxiangtupianshangchuan44/ 接下来,我们应 ...

  10. 【译】PGS字幕

    PGS(Presentation graphic stream):图形字幕流,是用来显示蓝光电影中的字幕的流.当蓝光盘中的PGS格式的字幕被分离存储的时候通常保存在一个以sup为扩展名的文件中.(也可 ...