php的缓存类

 更新时间:2016年11月25日 16:10  点击:1376
昨天在phpx.com找到的,真是爽极了.
感谢dxf218

我修正了其中一点点小小小的问题
<?php
/*
*    FileName                :    cache.inc.php
*    Link                    :   [url]http://blog.111cn.net/dxflingxing/[/url]
*    Author                    :   dxflingxing
*    Date                    :    2006-5-9
*    Last Modified            :    2006-5-16
*    Version                    :    1.0.1
*    Descrīption                :    Cache a page in file formart
*    Notice                    :    Make sure you cache file dir can be readed and wrote
*
*    Thanks to                :    小邪,barryonline(寒)
************************************************************
*
*    Usage                    :
*        # Cache active time half an hour
*        # This Can Auotmatic make some none exist dirs
*        # Or you can use an cache file in curent dir
*        # The Usage Such as
*        # $cache   
< <?php 

//定义一个excel文件 
$workbook "C:/My Documents/test.xls"
$sheet "Sheet1"

//生成一个com对象&ensp;$ex 
$ex = new COM("Excel.sheet") or Die ("连不上!!!"); 

//打开一个excel文件 
$book = &ensp;$ex->application->Workbooks->Open(&ensp;$workbook) or Die ("打不开!!!"); 

$sheets = &ensp;$book->Worksheets(&ensp;$sheet); 
$sheets->activate

//获取一个单元格 
$cell 创建类似"../../../xxx/xxx.txt"的目录都很好!

function mkdirs($path, $mode = 0777) //creates directory tree recursively
{
$dirs = explode(''/'',$path);
$pos = strrpos($path, ".");
if ($pos === false) { // note: three equal signs
// not found, means path ends in a dir not file
$subamount=0;
}
else {
$subamount=1;
}

for ($c=0;$c < count($dirs) - $subamount; $c++) {
$thispath="";
for ($cc=0; $cc <= $c; $cc++) {
$thispath.=$dirs[$cc].''/'';
}
if (!file_exists($thispath)) {
//print "$thispath<br>";
mkdir($thispath,$mode);
}
}
}

原函数中使用$GLOBALS["dirseparator"]我改成了''/''


function recur_mkdirs($path, $mode = 0777) //creates directory tree recursively
{
//$GLOBALS["dirseparator"]
$dirs = explode($GLOBALS["dirseparator"],$path);
$pos = strrpos($path, ".");
if ($pos === false) { // note: three equal signs
// not found, means path ends in a dir not file
$subamount=0;
}
else {
$subamount=1;
}

for ($c=0;$c < count($dirs) - $subamount; $c++) {
$thispath="";
for ($cc=0; $cc <= $c; $cc++) {
$thispath.=$dirs[$cc].$GLOBALS["dirseparator"];
}
if (!file_exists($thispath)) {
//print "$thispath<br>";
mkdir($thispath,$mode);
}
}

}

 

< <?php
$d=array(
array("a",-20319),
array("ai",-20317),
array("an",-20304),
array("ang",-20295),
array("ao",-20292),
array("ba",-20283),
array("bai",-20265),
array("ban",-20257),
array("bang",-20242),
array("bao",-20230),
array("bei",-20051),
array("ben",-20036),
array("beng",-20032),
array("bi",-20026),
array("bian",-20002),
array("biao",-19990),
array("bie",-19986),
array("bin",-19982),
array("bing",-19976),
array("bo",-19805),
array("bu",-19784),
array("ca",-19775),
array("cai",-19774),
array("can",-19763),
array("cang",-19756),
array("cao",-19751),
array("ce",-19746),
array("ceng",-19741),
array("cha",-19739),
array("chai",-19728),
array("chan",-19725),
array("chang",-19715),
array("chao",-19540),
array("che",-19531),
array("chen",-19525),
array("cheng",-19515),
array("chi",-19500),
array("chong",-19484),
array("chou",-19479),
array("chu",-19467),
array("chuai",-19289),
array("chuan",-19288),
array("chuang",-19281),
array("chui",-19275),
array("chun",-19270),
array("chuo",-19263),
array("ci",-19261),
array("cong",-19249),
array("cou",-19243),
array("cu",-19242),
array("cuan",-19238),
array("cui",-19235),
array("cun",-19227),
array("cuo",-19224),
array("da",-19218),
array("dai",-19212),
array("dan",-19038),
array("dang",-19023),
array("dao",-19018),
array("de",-19006),
array("deng",-19003),
array("di",-18996),
array("dian",-18977

实际上是毫无作用的函数了~因为现在的域名商都很滑。很多域名只要注册了,就算不使用也会被默认指向一个域名商的网址。所以即便探过去,都会返回一个200值。 = = 这也是没办法的事。

 


<?php
$url
= ''http://www.example.com''
;

print_r(get_headers($url
));

print_r(get_headers($url, 1
));
?>
Array(    [0] => HTTP/1.1 200 OK    [1] => Date: Sat, 29 May 2004 12:28:13 GMT    [2] => Server: Apache/1.3.27 (Unix)  (Red-Hat/Linux)    [3] => Last-Modified: Wed, 08 Jan 2003 23:11:55 GMT    [4] => ETag: "3f80f-1b6-3e1cb03b"    [5] => Accept-Ranges: bytes    [6] => Content-Length: 438    [7] => Connection: close    [8] => Content-Type: text/html)Array(    [0] => HTTP/1.1 200 OK    [Date] => Sat, 29 May 2004 12:28:14 GMT    [Server] => Apache/1.3.27 (Unix)  (Red-Hat/Linux)    [Last-Modified] => Wed, 08 Jan 2003 23:11:55 GMT    [ETag] => "3f80f-1b6-3e1cb03b"    [Accept-Ranges] => bytes    [Content-Length] => 438    [Connection] => close    [Content-Type] => text/html)

 

 

<?php
//$fp = file_get_contents("http://www.163.com");


$fp = fsockopen("www.selangsfer32.com", 80, $errno, $errstr, 30);
if (!$fp) {
echo "$errstr ($errno)<br />n";
exit;
}
?>



SyntaxHighlighter.highlight();

[!--infotagslink--]

相关文章

  • php svn操作类

    以前我们开发大型项目时都会用到svn来同步,因为开发产品的人过多,所以我们会利用软件来管理,今天发有一居然可以利用php来管理svn哦,好了看看吧。 代码如下 ...2016-11-25
  • PHP 数据库缓存Memcache操作类

    操作类就是把一些常用的一系列的数据库或相关操作写在一个类中,这样调用时我们只要调用类文件,如果要执行相关操作就直接调用类文件中的方法函数就可以实现了,下面整理了...2016-11-25
  • c#自带缓存使用方法 c#移除清理缓存

    这篇文章主要介绍了c#自带缓存使用方法,包括获取数据缓存、设置数据缓存、移除指定数据缓存等方法,需要的朋友可以参考下...2020-06-25
  • 源码分析系列之json_encode()如何转化一个对象

    这篇文章主要介绍了源码分析系列之json_encode()如何转化一个对象,对json_encode()感兴趣的同学,可以参考下...2021-04-22
  • php中去除文字内容中所有html代码

    PHP去除html、css样式、js格式的方法很多,但发现,它们基本都有一个弊端:空格往往清除不了 经过不断的研究,最终找到了一个理想的去除html包括空格css样式、js 的PHP函数。...2013-08-02
  • JS+CSS实现分类动态选择及移动功能效果代码

    本文实例讲述了JS+CSS实现分类动态选择及移动功能效果代码。分享给大家供大家参考,具体如下:这是一个类似选项卡功能的选择插件,与普通的TAb区别是加入了动画效果,多用于商品类网站,用作商品分类功能,不过其它网站也可以用,...2015-10-21
  • IDEA中的clean,清除项目缓存图文教程

    这篇文章主要介绍了IDEA中的clean,清除项目缓存图文教程,具有很好的参考价值,希望对大家有所帮助。一起跟随小编过来看看吧...2020-09-25
  • Php文件上传类class.upload.php用法示例

    本文章来人大家介绍一个php文件上传类的使用方法,期望此实例对各位php入门者会有不小帮助哦。 简介 Class.upload.php是用于管理上传文件的php文件上传类, 它可以帮...2016-11-25
  • index.php怎么打开?如何打开index.php?

    index.php怎么打开?初学者可能不知道如何打开index.php,不会的同学可以参考一下本篇教程 打开编辑:右键->打开方式->经文本方式打开打开运行:首先你要有个支持运行PH...2017-07-06
  • PHP实现无限级分类(不使用递归)

    无限级分类在开发中经常使用,例如:部门结构、文章分类。无限级分类的难点在于“输出”和“查询”,例如 将文章分类输出为<ul>列表形式; 查找分类A下面所有分类包含的文章。1.实现原理 几种常见的实现方法,各有利弊。其中...2015-10-23
  • PHP实现递归无限级分类

    在一些复杂的系统中,要求对信息栏目进行无限级的分类,以增强系统的灵活性。那么PHP是如何实现无限级分类的呢?我们在本文中使用递归算法并结合mysql数据表实现无限级分类。 递归,简单的说就是一段程序代码的重复调用,当把...2015-10-23
  • C#类中static变量用法分析

    这篇文章主要介绍了C#类中static变量用法,实例分析了static变量使用技巧与相关注意事项,需要的朋友可以参考下...2020-06-25
  • mybatis-plus实体类主键策略有3种(小结)

    这篇文章主要介绍了mybatis-plus实体类主键策略有3种(小结),文中通过示例代码介绍的非常详细,对大家的学习或者工作具有一定的参考学习价值,需要的朋友们下面随着小编来一起学习学习吧...2020-08-27
  • PHP中func_get_args(),func_get_arg(),func_num_args()的区别

    复制代码 代码如下:<?php function jb51(){ print_r(func_get_args()); echo "<br>"; echo func_get_arg(1); echo "<br>"; echo func_num_args(); } jb51("www","j...2013-10-04
  • ecshop商品无限级分类代码

    ecshop商品无限级分类代码 function cat_options($spec_cat_id, $arr) { static $cat_options = array(); if (isset($cat_options[$spec_cat_id]))...2016-11-25
  • PHP 一个完整的分页类(附源码)

    在php中要实现分页比起asp中要简单很多了,我们核心就是直接获取当前页面然后判断每页多少再到数据库中利用limit就可以实现分页查询了,下面我来详细介绍分页类实现程序...2016-11-25
  • PHP编程 SSO详细介绍及简单实例

    这篇文章主要介绍了PHP编程 SSO详细介绍及简单实例的相关资料,这里介绍了三种模式跨子域单点登陆、完全跨单点域登陆、站群共享身份认证,需要的朋友可以参考下...2017-01-25
  • 详解ES6实现类的私有变量的几种写法

    这篇文章主要介绍了详解ES6实现类的私有变量的几种写法,文中通过示例代码介绍的非常详细,对大家的学习或者工作具有一定的参考学习价值,需要的朋友们下面随着小编来一起学习学习吧...2021-02-10
  • PHP实现创建以太坊钱包转账等功能

    这篇文章主要介绍了PHP实现创建以太坊钱包转账等功能,对以太坊感兴趣的同学,可以参考下...2021-04-20
  • c#各种Timer类的区别与用法介绍

    System.Threading.Timer 是一个简单的轻量计时器,它使用回调方法并由线程池线程提供服务。在必须更新用户界面的情况下,建议不要使用该计时器,因为它的回调不在用户界面线程上发生...2020-06-25