php学习日记5(关于php中getCacheAll()方法的使用)

getCacheAll在php中的用法

getCacheAll是读取缓存文件的函数

比如常见的当前站点类别,是保存在缓存文件中的,读取的时候用:

1
$this->categorys = getcache(‘category_content_’.$this->siteid,’commons’);

 

 

具体实例:

<?php

$iterator = new ArrayIterator(array(1, 2, 3));

$cache    = new CachingIterator($iterator, CachingIterator::FULL_CACHE);

$cache->next();

$cache->next();

var_dump($cache->getCache());

$cache->next();

var_dump($cache->getCache());?>

以上例程会输出:

array(2) {
 [0]=>
 int(1)
 [1]=>
 int(2)
}
array(3) {
 [0]=>
 int(1)
 [1]=>
 int(2)
 [2]=>
 int(3)
}

>

原文地址:https://www.cnblogs.com/sun1512/p/7325277.html