例如,通用的當前站點類別保存在緩存文件中,讀取時使用:
$ this-& gt;類別?=?getcache('category_content_ ')。$ this-& gt;siteid,' commons ');具體例子:
& lt?服務器端編程語言(Professional Hypertext Preprocessor的縮寫)
$叠代器?=?新的?ArrayIterator(array(1,2,?3));
$cache=?新的?CachingIterator($iterator,?caching iterator::FULL _ CACHE);
$ cache-& gt;next();
$ cache-& gt;next();
var _ dump($ cache-& gt;get cache());
$ cache-& gt;next();
var _ dump($ cache-& gt;get cache());
& gt
上述例程將輸出:
數組(2) {
?[0]= >
?int(1)
?[1]= >
?int(2)
}
數組(3) {
?[0]= >
?int(1)
?[1]= >
?int(2)
?[2]= >
?int(3)
}