最新下载
热门教程
- 1
- 2
- 3
- 4
- 5
- 6
- 7
- 8
- 9
- 10
Windows下Smarty的安装
时间:2008-02-26 编辑:简简单单 来源:一聚教程网
下载解压缩就不用说了
官方网站:http://smarty.php.net
php.net也有相关资料:http://news.php.net/php.smarty.dev/2703
Installation - Windows, IIS/Apache, PHP5
Extract files, rename Smarty.x.x.x to smarty (suggest OUTSIDE of your www root!)
Example: D:smarty
Run phpinfo.php to find out your php.ini location
//这个phpinfo.php在哪里?没找着,不Run也罢,往下看。
Edit php.ini's include_path and add the location of the libs folder.
//修改php.ini 查找include_path这个字段,照下面的方式修改,目录名称及路径自己定义,只要与实际解压目录的路径相同就OK了。
example: include_path = ".;D:smartylibs"
Restart IIS/Apache
Setup these two folders INSIDE your www root:
//在WEB服务器根下建立templates和configs这两个文件(smarty目录也是自己建的)
(wwwroot)/smarty/templates (this is where your templates will go)
(wwwroot)/smarty/configs
Setup these two folders OUTSIDE of your www root:
//在smarty的解压目录建立templates_c和cache这两个目录。
D:/smarty/templates_c
D:/smarty/cache
Setup security settings for the webserver to write to these four folders
//templates 、configs 、templates_c 、cache 这四个目录必须是可写权限
In (wwwroot) create index.php and in (wwwroot)/smarty/templates/index.tpl with the following code:
//创建index.php及index.tpl两个文件测试Smarty是否安装成功,代码如下:
index.php:
pHP代码:
// load Smarty library
require('Smarty.class.php');
$smarty = new Smarty;
$smarty->template_dir = 'D:/inetpub/wwwroot/smarty/templates';
$smarty->config_dir = ' D:/inetpub/wwwroot/smarty/config';
$smarty->cache_dir = 'D:/smarty/smarty_cache';
$smarty->compile_dir = 'D:/smarty/smarty_templates_c';
$smarty->assign('name','fish boy!');
$smarty->display('index.tpl');
?>
index.tpl
复制内容到剪贴板
Hello, {$name}!
Now open index.php in your web browser (requested from your webserver)
//现在运行index.php,如果看到"Hello, fish boy!! "说明安装成功
-
上一个: php常用正则表达精品
-
下一个: php防注入式攻击心得
相关文章
- GPT分区安装Win7系统失败怎么办 07-05
- win10ttf字体安装无效怎么办 ttf字体无效解决办法 06-01
- windows10政府版怎么使用 windows10政府版下载安装教程 05-24
- 安装MeeGo和Win7双系统方法 04-18
- Windows Server 2016安装方法 04-05
- win10环境下python3.5安装步骤图文教程 03-13