久久福利_99r_国产日韩在线视频_直接看av的网站_中文欧美日韩_久久一

您的位置:首頁技術文章
文章詳情頁

在CentOS上成功安裝Smarty

瀏覽:5日期:2024-07-10 10:43:39

根據Smarty的文檔說明安裝了Smarty,結果測試不成功,后來發現是templates_c目錄權限設置不當(要設置成777)。現根據其QUICK_START文件,把整個安裝過程描述如下,以作備查。

1、下載最新Smarty軟件,比如最新Smarty-2.6.20.tar.gz下載到test用戶根目錄下

http://www.smarty.net/

2、解壓并拷貝libs目錄到某個目錄下(假設已經在/usr/lib/php/目錄下已建smarty目錄)

test$ tar zxvf Smarty-2.6.20.tar.gz

test$ cp Smarty-2.6.20/libs/* /usr/lib/php/smarty -r

此時smarty目錄結構如下:

/usr/lib/php/smarty/Config_File.class.phpdebug.tplinternals/plugins/Smarty.class.phpSmarty_Compiler.class.php

3、新建WEB目錄和相關目錄

test$ cd /var/www/html

test$ mkdir smarty

test$ mkdir smarty/templates

test$ mkdir smarty/templates_c

test$ mkdir smarty/cache

test$ mkdir smarty/configs

test$ chmod 777 smarty/templates_c //不成功的原因就在此,原為775

test$ chmod 777 smarty/cache //設置成與上述相同的權限

4、新建一個PHP文件

test$ cd /var/www/html/smarty

test$ vi index.php 添加如下內容

<?php// put full path to Smarty.class.phprequire(’/usr/lib/php/smarty/Smarty.class.php’);$smarty = new Smarty();$smarty->template_dir = ’/var/www/html/smarty/templates’;$smarty->compile_dir = ’/var/www/html/smarty/templates_c’;$smarty->cache_dir = ’/var/www/html/smarty/cache’;$smarty->config_dir = ’/var/www/html/smarty/configs’;$smarty->assign(’name’, ’Ned’);$smarty->display(’index.tpl’);?>

5、新建模板文件

test$ cd /var/www/html/smarty/templates

test$ vi index.tpl 添加如下內容

<html><head><title>Smarty</title></head><body>Hello, {$name}!</body></html>

6、測試成功與否

在瀏覽器中訪問http://localhost/index.php,如果成功可以看到“Hello Ned!”。

標簽: CentOS
相關文章:
主站蜘蛛池模板: 91在线看片| 中文字幕精品一区 | 久久免费视频观看 | 亚洲综合婷婷 | 日本一区二区不卡 | 国产精品99久久久久久大便 | 日韩中文字幕国产 | 国产精品99久久 | 成人亚洲免费 | 欧美综合在线观看 | 国产高清在线看 | 国产成人精品av | 天天曰夜夜操 | 免费黄色电影在线观看 | 91在线综合| 亚洲高清免费 | 精品一区二区三区免费视频 | 久久久日韩精品一区二区三区 | 亚洲精选一区 | 久久久久国产 | 色婷婷综合在线 | 欧美精品亚洲精品日韩精品 | 欧美性猛交一区二区三区精品 | 在线色网 | 亚洲精品电影在线观看 | 在线观看毛片网站 | 91精品国产高清一区二区三区 | 精品亚洲一区二区三区四区五区 | 欧美lesbianxxxxhd视频社区 | 福利久久久 | 欧美激情五月 | 成人一区二区三区久久精品嫩草 | 欧美激情在线精品一区二区三区 | 免费看的黄色网 | 午夜视频 | 欧美精品1区2区3区 国产女无套免费网站 | 欧美一区2区三区3区公司 | 日日摸天天爽天天爽视频 | 久久综合中文字幕 | 中文字幕久久精品 | 国产成人精品一区二 |