示例#1
0
文件: Inflate.php 项目: rgantt/japha
    private $total = array();
    function __construct($filename)
    {
        if (file_exists($filename)) {
            $this->filename = $filename;
        } else {
            throw new Exception($filename . " does not exist!");
        }
    }
    public function compress()
    {
        $w = fopen($this->filename, "r");
        while (!feof($w)) {
            $this->total[] = gzencode(fgets($w, 4096), 5);
        }
    }
    public function saveFile($filename)
    {
        $s = gzopen($filename, "w");
        foreach ($this->total as $key => $value) {
            gzputs($s, $key, 4096);
        }
    }
}
$m = new Melder(array("pdbc.php", "all.php", "xml.php"));
$m->mergeFiles();
$m->saveFile("newShizzy.shizzle");
$c = new Compressor("newShizzy.shizzle");
$c->compress();
$c->saveFile("dsh");