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>
相关文档:
http://www.xhsd.com.cn/books/views.asp?plucode=711126281
这本书被称为PHP和MySQL的“圣经”,仔细看了一下,的确有很多独到的地方。
首先,内容明确突出。这本书的目的是对PHP和MySQL做深入浅出的分析,对其Web应用做了较全面的阐述,例子经典实用。
其次,新。PHP5.3,MySQL的存储过程和存储引擎,Ajax技 ......
现在主流的网站开发语言无外乎asp、php、asp.net、jsp等。
网页从开始简单的hmtl到复杂的服务语言,走过了10多个年头,各种技术层出不穷,单个的主流技术也在不断翻新的版本,现在分析下各种语言的区别、优势、劣势、开发注意事项!
HTML:当然这是网页最基本的语言,每一个服务器语言都需要它的支持,要学习,这个肯定是开始 ......
PHP函数setcookie()用来设置cookie.
setcookie()函数必须在<html>标签之前调用,语法是setcookie (name, value, expire,
path, domain) 例如:
<?php
setcookie(”user”, “Alex
Porter”, time()+3600);
?>
<?php
setcookie(”url”, “http://www.mianwww. ......
【1】页面之间无法传递变量 get,post,session在最新的php版本中自动全局变量是关闭的,所以要从上一页面取得提
交过来得变量要使用$_GET['foo'],$_POST['foo'],$_SESSION['foo']来得到。当然也可以修改自动全局变量为开
(php.ini改为register_globals = On);考虑到兼容性,还是强迫自己熟悉新的写法比较好。
【2 ......
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 ......