src/FileCache.php
private function getFileData($fileName)
    {
        if (! is_file($fileName)) {
            return null;
        }
        $createTime = filectime($fileName);
        $data = json_decode(file_get_contents($fileName), true);
        //判断是否过期
        if ($data['expire'] != '0' && ($data['expire'] + $createTime) < time()) {
            unlink($fileName);
            return null;
        }
        return $data['data'];
    }
private function getFileData($fileName)
    {
        if (! is_file($fileName)) {
            return null;
        }
        $createTime = filectime($fileName);
        $data = json_decode(file_get_contents($fileName), true);
        //判断是否过期
        if ($data['expire'] != '0' && ($data['expire'] + $createTime) < time()) {
            unlink($fileName);
            return null;
        }
        return $data['data'];
    }
private function getFileData ( $ fileName ) { if ( ! is_file ( $ fileName ) ) { return null ; } $ createTime = filectime ( $ fileName ) ; $ data = json_decode ( file_get_contents ( $ fileName ) , true ) ; //判断是否过期 if ( $ data [ 'expire' ] != '0' && ( $ data [ 'expire' ] + $ createTime ) < time ( ) ) { unlink ( $ fileName ) ; return null ; } return $ data [ 'data' ] ; }
获得文件内容
@param $fileName
获得文件内容