var_export 文件缓存经常使用 输出或返回一个变量的字符串表示
- public function set($mode, $id, $data, $expired = -1)
- {
- if( empty($mode) || empty($id) ){return false;}
-
- $path = $this->getComFilename($mode ,$id);
-
- $expired = ($expired < 0) ? -1 : time() + $expired;
- $content = array(
- ‘expired‘ => $expired,
- ‘data‘ => $data,
- );
- $content = ‘<?php return ‘ . var_export($content, true) . ‘;‘;
-
-
- file_put_contents($path, $content, LOCK_EX);
-
- clearstatcache();
-
- $this->_cachelist($path,$mode);
- return true;
- }
var_export 掉咋天
原文:http://www.cnblogs.com/wangluochong/p/7049898.html