<?php
header('content-type:text/html;charset="utf8"');
error_reporting(E_ALL^E_NOTICE^E_WARNING);
$memcache = new Memcache();
$memcache->connect('localhost','11211')or die('Memcached连接失败');
//定义一个对象
$tmp_object = new stdClass();
$tmp_object->username='tomm';
$tmp_object->password='123';
$tmp_object->msg='hello~my name is tom';
//memcache->set('设置值的key','设置存储的值','是否使用MEMCACHE_COMPRESSED压缩,0或false表示不压缩','过期时间/秒')
$memcache->set('user',$tmp_object,false,10);
$get_res = $memcache->get('user');
// $id = $_GET['id'];
$id = 11;
$filename = "static_id_".$id.".html";
$status = filemtime($filename)+30>time();//判断文件创建及修改时间距当前时间是否超过30秒
if(file_exists($filename)&&$status){
$str = file
php+memcached实现定时静态页面生成
最新推荐文章于 2021-04-03 08:05:43 发布