最新国产好看的视频,伊人天堂AV在线,国产Aaaaaa视频,蜜臀视频在线观看一区,人妻av色图,密臀久久久精品影片,青青视频免费观看毛片,久草在线观看视,国产三级精品色情在线

SMARTY學(xué)習手記

 更新時間:2007年01月04日 00:00:00   作者:  
學(xué)習PHP不能不提下SMARTY,作為著名的模板程序,SMARTY自然有其優(yōu)勢。下面是我總結(jié)的自己的一點學(xué)習心得吧!
=====================================
先在smarty.php.net下載最新smarty
將libs文件夾放在你的WEB目錄下,我是放在smarty下的,目錄情況如下:e:/smarty/libs
在smarty目錄下新建如下文件夾:
templates(這里放你的模板文件,即tpl文件)
configs
templates_c(自動將編譯完的文件轉(zhuǎn)成PHP放在這)
cache
然后在wwwroot目錄下建立index.php:
<?php 
include "smarty/libs/Smarty.class.php"; 
define('__SITE_ROOT', 'e:/smarty'); // 最後沒有斜線 
$tpl = new Smarty(); 
$tpl->template_dir = __SITE_ROOT . "/templates/"; 
$tpl->compile_dir = __SITE_ROOT . "/templates_c/"; 
$tpl->config_dir = __SITE_ROOT . "/configs/"; 
$tpl->cache_dir = __SITE_ROOT . "/cache/"; 
//$tpl->left_delimiter = '<{';  可根據(jù)需要更改。 
//$tpl->right_delimiter = '}>'; 
$tpl->assign('name','world!'); 
$tpl->display('index.tpl')
?> 

在template目錄下建立index.tpl:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN"> 
<html> 
<head> 
<title> New Document </title> 
<meta name="Generator" content="EditPlus"> 
<meta name="Author" content=""> 
<meta name="Keywords" content=""> 
<meta name="Description" content=""> 
</head> 

<body> 
hello,{$name}~. 
</body> 
</html> 



然后本地index.php顯示出hello,world!~.

相關(guān)文章

最新評論

定边县| 嘉禾县| 启东市| 逊克县| 宁乡县| 平塘县| 邳州市| 定南县| 万全县| 新乐市| 西城区| 凤台县| 保定市| 西昌市| 磐安县| 遂昌县| 磐安县| 达拉特旗| 民和| 玛多县| 镇平县| 麻阳| 娱乐| 榕江县| 郸城县| 淳化县| 蛟河市| 盐池县| 芦溪县| 广南县| 邯郸市| 鄂伦春自治旗| 十堰市| 日土县| 攀枝花市| 铜鼓县| 会东县| 府谷县| 宜君县| 拜泉县| 启东市|