smarty简单入门实例,smarty实例
本文以一个简单实例分析了smarty的用法。分享给大家供大家参考。具体分析如下:
smarty建立配置文件、显示文件后即可,配置文件显示文件分开来,使美工跟开发工作能完美分开
配置页面代码:index.php
复制代码 代码如下:
@header("Content-type: text/html; charset=UTF-8");
require '../libs/Smarty.class.php';
$my=new Smarty;
$my->template_dir ='templates/';
$my->compile_dir ='templates_c/';
$my->config_dir ='configs/';
$my->cache_dir ='cache/';
$my->assign('content','welcome to arrival');
$my->assign('mylife',array("生活","吃饭","梦想","凉风"));
$my->display('kk.html'); //显示smarty目录下的kk.html
?>
kk.html
复制代码 代码如下:
{$content}
{section name=truelife loop=$mylife}
{$mylife[truelife]}
{/section}
希望本文所述对大家的smarty程序设计有所帮助。

Hot AI Tools

Undresser.AI Undress
AI-powered app for creating realistic nude photos

AI Clothes Remover
Online AI tool for removing clothes from photos.

Undress AI Tool
Undress images for free

Clothoff.io
AI clothes remover

AI Hentai Generator
Generate AI Hentai for free.

Hot Article

Hot Tools

SecLists
SecLists is the ultimate security tester's companion. It is a collection of various types of lists that are frequently used during security assessments, all in one place. SecLists helps make security testing more efficient and productive by conveniently providing all the lists a security tester might need. List types include usernames, passwords, URLs, fuzzing payloads, sensitive data patterns, web shells, and more. The tester can simply pull this repository onto a new test machine and he will have access to every type of list he needs.

ZendStudio 13.5.1 Mac
Powerful PHP integrated development environment

Atom editor mac version download
The most popular open source editor

PhpStorm Mac version
The latest (2018.2.1) professional PHP integrated development tool

SublimeText3 Mac version
God-level code editing software (SublimeText3)