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 静 ......
现在主流的网站开发语言无外乎asp、php、asp.net、jsp等。
网页从开始简单的hmtl到复杂的服务语言,走过了10多个年头,各种技术层出不穷,单个的主流技术也在不断翻新的版本,现在分析下各种语言的区别、优势、劣势、开发注意事项!
HTML:当然这是网页最基本的语言,每一个服务器语言都需要它的支持,要学习,这个肯定是开始 ......
其实这个的主要部分并不是一个jquery,但是必须使用到
php程序部分,也只需要这个一个php程序就可以了
www.corange.cn亲测
<?php
header("Content-Type: text/html; charset=utf-8");
@header( "Cache-Control: no-cache, must-revalidate" );
@header( "Pragma: no-cache" );
@header( "Last-Modified: " ......
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 ......
在PHP中,入栈通过array_push函数实现,语法如下:
int array_push(array,var [,var …])
var为要压入数组的元素,array为数组。函数返回数组新的元素总数。
例如:
<?php
$php = array("php","phpdo","php学习");
print_r($php);
array_push($php, ......