可以使用 get_headers 來查看 url 的 file size
$head = array_change_key_case(get_headers("http://example.com/file.ext", TRUE)); $filesize = $head['content-length'];
array_change_key_casearray_change_key_case — Changes the case of all keys in an array是把array內的key都轉成同樣大小寫,預設是小寫。
PHP: array_change_key_case - Manualhttp://php.net/manual/en/function.array-change-key-case.phphttp - Easiest way to grab filesize of remote file in PHP? - Stack Overflow https://stackoverflow.com/questions/1401131/easiest-way-to-grab-filesize-of-remote-file-in-php
沒有留言:
張貼留言