application/common/util/File.class.php

(开头部分) 12KB

这里只显示每个文件的开头 60 行。登录后可以解锁完整代码。

<?php
/**
 * Created by Green Studio.
 * File: File.class.php
 * User: Timothy Zhang
 * Date: 14-1-31
 * Time: 下午2:53
 */

namespace Common\Util;

use think\Storage;


/**
 * Class File
 * @package Common\Util
 */
class File
{

    /**
     * 运行于 Sae 和 LAMP
     * @param $filename
     * @return bool
     */
    public static function file_exists($filename)
    {
        $Storage = new Storage();
        $Storage::connect();
        return $Storage::has($filename);
    }

    /**
     * 运行于 Sae 和 LAMP
     * @param $bytes
     * @return string
     */
    public static function byteFormat($bytes)
    {
        $size_text = array(" B", " KB", " MB", " GB", " TB", " PB", " EB", " ZB", " YB");
        return round($bytes / pow(1024, ($i = floor(log($bytes, 1024)))), 2) . $size_text[$i];
    }


    /**
     * @param $filename
     * @return string
     */
    static public function readFile($filename)
    {
        $content = '';
        $Storage = new Storage();
        $Storage::connect();
        @$content = $Storage::read($filename);
        return $content;
    }


    /**
后面还有 439 行代码,购买后查看完整代码

24 小时内免费解锁 3 个项目,之后 1 积分/个。 规则说明

AI 解读

登录后可用,每次 10 积分,解读结果公开显示在下面。

还没有人解读过这个文件。