Home  >  Article  >  php教程  >  F 快速缓存改造版

F 快速缓存改造版

WBOY
WBOYOriginal
2016-06-07 11:45:531702browse

function F($name, $value='', $path = DATA_PATH) {<br>     $filename = $path . $name . '.php';<br> <br>     switch ($value){<br>         case ''        : goto read;<br>         case NULL    : return unlink($filename);<br>         default        : <br>             $dir = dirname($filename); is_dir($dir) or mkdir($dir,0755,true); <br>             return file_put_contents($filename, json_encode($value));<br>     }<br> <br>     read:<br>     if (is_file($filename)) {<br>         return json_decode(file_get_contents($filename), true);<br>     } else {<br>         return false;<br>     }<br> }PHP 5.3+有效

AD:真正免费,域名+虚机+企业邮箱=0元

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn