How to split the merged file by the PHP breakpoint continuation

Source: Internet
Author: User

  This article mainly introduces how to split the file of PHP breakpoint, the need for friends can refer to the following

  Code as follows: <?php  ini_set ("Memory_limit", "50M");/must, according to the actual situation of your environment as large as possible, to prevent errors   ini_set ("Max_execution_ Time ",";  ") the//file_exists () function checks whether a file or directory exists, returns True if it exists, or returns false. The  //fread () function reads files (which are safe for binary files). Fread () reads up to length bytes from file pointer files. The  //filesize () function returns the size (in bytes) of the specified file. The result of this function is cached. Please use Clearstatcache () to clear the cache.   $orgFile = ' fireworks8-chs.exe ';//source file   $cacheFileName = ' vbcache ';//Split temporary file block   function Cutfile ($ FileName, $block) {//split   global $cacheFileName;  if (!file_exists ($fileName)) return false;  $num = 1;& nbsp $file = fopen ($fileName, ' RB ');  while ($content = Fread ($file, $block)) {  $cacheFile = $cacheFileName. $num + + . '. Dat ';  $cfile = fopen ($cacheFile, ' WB ');  fwrite ($cfile, $content);  fclose ($cfile); }  Fclose ($file); }  function Mergefile ($targetFile) {//merge   global $cacheFileName;  $num = 1;  $ File = fopen ($targetFile, ' WB ');  while ($num > 0) {  $cacheFile = $cacheFileName. $num + +. '. Dat ';  if (file_exists ($cacheFile)) {  $cfile = fopen ($cacheFile, ' RB ');  $content = fread ($cfile, files Ize ($cacheFile));  fclose ($cfile);  fwrite ($file, $content); }  else {  $num = -1; }& nbsp }  fclose ($file); } //Call   Cutfile ($orgFile, pow (2,20)); The * POW (2,20) equals the 10M Pow () function returns X's y   mergefile (' Ok.exe '); ?>   

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.