php smarty 安装 、配置、使用 及缓存cache的配置使用
cache 使用:
cache配置:
$smarty->cache_dir = "/caches/"; //缓存目录
$smarty->caching = true; //开启缓存,为flase的时侯缓存无效
$smarty->cache_lifetime = 60; //缓存时间
cache清除和使用:
$smarty->display('cache.tpl', cache_id); //创建带ID的缓存
cache.tpl //模板文件
$smarty->clear_all_cache(); //清除所有缓存
$smarty->clear_cache('index.htm'); //清除index.tpl的缓存
$smarty->clear_cache('index.htm',cache_id); //清除指定id的缓存
smarty 安装配置 说明:
下载smarty解压 将libs目录 copy到项目主目录下,至少建立如下如下文件夹:templates templates_c configs cache
index.php
<?php
include("libs/Smarty.class.php");
$smarty = new Smarty;
$smarty->template_dir = './templates/';
$smarty->compile_dir = './templates_c/';
$smarty->config_dir = './configs/';
$smarty->cache_dir = './cache/';
$smarty->caching = true;
$smarty->cache_lifetime = 60;
$smarty->left_delimiter = "<{";
$smarty->right_delimiter = "}>";
$smarty->assign("title", "垃圾");
$smarty->assign("content","测试用的网页内容00");
$smarty->display("index.tpl",cache_id);
?>
index.tpl模板文件
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<title><{$title}></title>
</head>
<body>
<{$content}>
</body>
</html>
相关文档:
php基础学习已经差不多了,但是为检验自己的学习掌握情况,把php基础知识回顾复习了一下
第一个PHP程序
<?php
echo "Hello World!";
?>
1 注释
1.1多行
/*
xxxx
*/
1.2单行
//xxxxx
2. 赋值
$a = 'test';
2.1 检查变量是否已声明
isset($a)
2.2 释放变量
unset($a);
2.3 静 ......
PHP4:奇迹背后
1995年时,Rasmus在用PHP写他的个人主页;今天,PHP成为风靡全球的脚本语言,越来越多的站点选择使用PHP,连Yahoo都放弃了自己的脚本而改用PHP支持它的网站。可以说,PHP是一个奇迹。我一直认为,任何奇迹背后都有它的原因。现在,就让我们透过这个奇迹,来看看PHP的成功之道。
1 简单易用
PHP的入门门槛 ......
整理一篇比较详细的windows下php运行环境的配置的资料,包括apache的安装、mysql的安装、php的安装、 ZendOptimizer 的安装、phpMyAdmin的安装,包括安装过程会出现的问题的解决,比如:phpMyAdmin数据库中文乱码的解决等。
//****************
1、软件
(1)apache_2.2.4-win32-x86-no_ssl.zip
(2)mysql-5.0.27-win32.zi ......
VC9,VC6,Thread Safe,Non Thread Safe的意思?
时间:2009-10-07 10:55来源:网络 作者:CNITonline.com整理 我要投稿 注册IT家园
最近在PHP官网上看到又有新版的PHP下载了,于是上去找找For Windows的版本,可是一看确傻眼了,一共给了四个版本,VC9 x86 Non Thread Safe、VC9 x86 Thread Safe、VC6 x86 Non Thread Safe、VC ......
一、问题起源
稍大一些的网站,通常都会有好几个服务器,每个服务器运行着不同功能的模块,使用不同的二级域名,而一个整体性强的网站,用户系统是统一的,即一套
用户名、密码在整个网站的各个模块中都是可以登录使用的。各个服务器共享用户数据是比较容易实现的,只需要在后端放个数据库服务器,各个服务器通过统一接
......