12345678910111213141516 |
- #! php.exe
- # PHP CLI code, to encode config.json with gzcompress and base64
- # gzcompress can smaller the string 10 times or more, base64 can make sure that
- # the data can be saved and transfered safely by http.
- # author: gwang
- # version: 1.0
- <?php
- $filename = $argv[1];
- $handle = fopen($filename, "rb");
- $contents = fread($handle, filesize($filename));
- fclose($handle);
- // 将json串先压缩 再进行base64编码
- $str = base64_decode(gzdeflate($contents));
- // $str = base64_encode(gzcompress($contents));
- echo $str;
|