1 | <?php |
||
4 | class Util |
||
5 | { |
||
6 | public static function trim($str) |
||
14 | |||
15 | 8 | public static function getHeaderParams($headers) |
|
26 | |||
27 | 1 | public static function parseDir($body) |
|
28 | { |
||
29 | 1 | $files = array(); |
|
30 | 1 | if (!$body) { |
|
31 | 1 | return array(); |
|
32 | } |
||
33 | |||
34 | 1 | $lines = explode("\n", $body); |
|
35 | 1 | foreach ($lines as $line) { |
|
36 | 1 | $file = []; |
|
37 | 1 | list($file['name'], $file['type'], $file['size'], $file['time']) = explode("\t", $line, 4); |
|
38 | 1 | $files[] = $file; |
|
39 | 1 | } |
|
40 | |||
41 | 1 | return $files; |
|
42 | } |
||
43 | |||
44 | 2 | public static function base64Json($params) |
|
48 | |||
49 | public static function stringifyHeaders($headers) |
||
57 | |||
58 | public static function md5Hash($resource) |
||
66 | |||
67 | /** |
||
68 | * GuzzleHttp\Psr\Uri use `parse_url`,not good for utf-8, |
||
69 | * So should `encodeURI` first, before `new Psr7\Request` |
||
70 | * @see http://stackoverflow.com/questions/4929584/encodeuri-in-php |
||
71 | */ |
||
72 | 13 | public static function encodeURI($url) |
|
87 | } |
||
88 |