Home  >  Article  >  Backend Development  >  PHP之Smarty学习

PHP之Smarty学习

WBOY
WBOYOriginal
2016-06-23 14:32:00817browse

参考网络上的资料,使用Smarty可以简单的测试:

1.解压Smarty到网站目录下,比如起名libs.

2.建立templates,templates_c,configs,cache目录

3.建立测试页面:index.php

require "main.php";

//$tpl在main.php中定义


$tpl->assign("title", "测试用的网页标题");
$tpl->assign("content", "测试用的网页内容");
// 上面两行也可以用这行代替
// $tpl->assign(array("title" => "测试用的网页标题", "content" => "测试用的网页内容"));
$tpl->display('Index.htm');
?>

4.在templates下建立模板文件index.htm


  


  
Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Previous article:admin.php 的变量Next article:[转]php读取xml