Simple example:
split.php <?php $i = 0; Divided block number $fp = fopen ("abc.wmv", "RB"); The file to split $file = fopen ("Split_hash.txt", "a"); A text file that records the split information while (!feof ($FP)) { $handle = fopen ("abc.wmv.{ $i} "," WB "); Fwrite ($handle, Fread ($fp, 5000000)); 5000000 can be customized. Is the size of each file split Fwrite ($file, "qqdjz_002.wmv.{ $i}\r\n "); Fclose ($handle); Unset ($handle); $i + +; } Fclose ($FP); Fclose ($file); echo "OK"; ?> join.php <?php $mov = file_get_contents ("Abc.txt"); Reading information for split files $list = Explode ("\ r \ n", $mov); $fp = fopen ("split.wmv", "AB"); Merged file name foreach ($list as $value) { if (!empty ($value)) { $handle = fopen ($value, "RB"); Fwrite ($fp, Fread ($handle, FileSize ($value)); Fclose ($handle); Unset ($handle); } } Fclose ($FP); ?> |
This article links http://www.cxybl.com/html/wlbc/Php/20130326/37393.html