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

SMARTY學(xué)習(xí)手記

 更新時(shí)間:2007年01月04日 00:00:00   作者:  
學(xué)習(xí)PHP不能不提下SMARTY,作為著名的模板程序,SMARTY自然有其優(yōu)勢(shì)。下面是我總結(jié)的自己的一點(diǎn)學(xué)習(xí)心得吧!
=====================================
先在smarty.php.net下載最新smarty
將libs文件夾放在你的WEB目錄下,我是放在smarty下的,目錄情況如下:e:/smarty/libs
在smarty目錄下新建如下文件夾:
templates(這里放你的模板文件,即tpl文件)
configs
templates_c(自動(dòng)將編譯完的文件轉(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)文章

最新評(píng)論

灌阳县| 湾仔区| 阿荣旗| 巴林右旗| 马鞍山市| 阿坝县| 长泰县| 临安市| 务川| 文登市| 蒙自县| 彭泽县| 通化市| 永登县| 井冈山市| 通河县| 新民市| 江永县| 安陆市| 阆中市| 龙南县| 辽宁省| 太原市| 河源市| 虞城县| 微博| 青铜峡市| 鹰潭市| 孟津县| 杂多县| 张家口市| 丹棱县| 拉萨市| 平安县| 榆社县| 陆河县| 邯郸县| 古浪县| 固阳县| 松潘县| 武夷山市|