PHP模板引擎Smarty缓存应用
1:smarty 缓存的配置
Php代码
$smarty->cache_dir = "/caches/"; //缓存目录
$smarty->caching = true; //开启缓存,为flase的时侯缓存无效
$smarty->cache_lifetime = 60; //缓存时间
2:smarty缓存的使用和清除
Php代码
$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->display('cache.tpl', cache_id); //创建带ID的缓存
3:smarty的局部缓存
insert 函数默认是不缓存的。并且这个熟悉不能修改
Html代码
模板 index.htm
<div> {insert name="get_time"}</div>
index.php
<?php
function insert_get_time(){
return date("y-m-d");
}
?>
相关文档:
<?php
$host="192.168.1.214";
$post=21;
$username="zwc3g";
$password="zwc3ggg";
$ftp=ftp_connect($host,$post);
ftp_login($ftp,$username,$password);
displayTheFolder($ftp,"/zhulu2");
//打印FTP上的该目录下的所有文件。
fu ......
计划任务(Schedule Task)是windows平台上和cron类似的一个程序,当然功能上差了很多了。
因为需要每个小时运行一个PHP程序,手动操作不现实了。
首先在cmd下测试,例如: c:\appserv\php5\php.exe "C:\AppServ\www\temp2.php"
有一点要注意就是如果那个PHP引用了其他页面,需要提供绝对路径了,至少我的测试 ......
PHP模拟SMTP发送邮件的类
<?php
/*********************************************************
filename:mail.class.php
describe:邮箱的配置,经测试可以适用于Linux和windows
function:检查邮箱的合法性,发送基本的邮箱验证信息
author: etongchina@gmail. ......