Conditions | 4 |
Paths | 3 |
Total Lines | 17 |
Lines | 0 |
Ratio | 0 % |
Changes | 0 |
1 | <?php |
||
15 | function getUpyunFileSize($path) |
||
16 | { |
||
17 | $url = getFileUrl($path); |
||
18 | $ch = curl_init($url); |
||
19 | curl_setopt($ch, CURLOPT_NOBODY, true); |
||
20 | curl_setopt($ch, CURLOPT_HEADER, true); |
||
21 | curl_setopt($ch, CURLOPT_RETURNTRANSFER, true); |
||
22 | $return = curl_exec($ch); |
||
23 | preg_match('~^HTTP/1.1 (\d{3})~', $return, $match1); |
||
24 | preg_match('~Content-Length: (\d+)~', $return, $match2); |
||
25 | |||
26 | if (isset($match1[1]) && $match1[1] == 200) { |
||
27 | return isset($match2[1]) ? intval($match2[1]) : false; |
||
28 | } else { |
||
29 | return false; |
||
30 | } |
||
31 | } |
||
32 |