参考网络上的资料,使用smarty可以简单的测试:
1.解压Smarty到网站目录下,比如起名libs.
2.建立templates,templates_c,configs,cache目录
3.建立测试页面:index.php
require "main.php";
立即学习“PHP免费学习笔记(深入)”;
//$tpl在main.php中定义
$tpl->assign("title", "测试用的网页标题");
$tpl->assign("content", "测试用的网页内容");
// 上面两行也可以用这行代替
// $tpl->assign(array("title" => "测试用的网页标题", "content" => "测试用的网页内容"));
$tpl->display('Index.htm');
?>
4.在templates下建立模板文件index.htm
PHP怎么学习?PHP怎么入门?PHP在哪学?PHP怎么学才快?不用担心,这里为大家提供了PHP速学教程(入门到精通),有需要的小伙伴保存下载就能学习啦!
Copyright 2014-2025 https://www.php.cn/ All Rights Reserved | php.cn | 湘ICP备2023035733号