php¶ÏµãÐø´«Ö®Îļþ·Ö¸îºÏ²¢Ïê½â

5年以前  |  阅读数:927 次  |  编程语言:PHP 

phpʵÏֶϵaÐø´«£¬¾ÍÐeÒª°Ñ´oÎļþ*Ö¸i³É¶a¸oСÎļþ£¬È»ºoµ¥¸oÉÏ´«¡£´«ÍeºoÔںϲ¢¡£

*(C)¦ merge.php ¨CºÏ²¢Îļþ½Å±¾
(C)¦ merge.zip ¨CºÏ²¢ºoÎļþ
(C)¦ socket.zip ¨CÐeÒª
Ö¸iµÄÎļþ
(C)¦ split.php ¨CÖ¸iÎļþ½Å±¾
(C)¦
(C)¸(C)¤split ¨C
Ö¸iºoСÎļþĿ¼**

ÏÂÃaeÊÇÔ´Âe

split.php


    <?php

    $fp = fopen("socket.zip", "rb");
    $filesize = 10;
    $i = 0;
    $no = 1;
    while(!feof($fp))
    {
      $file = fread($fp, $filesize);

      $fp2 = fopen("./split/socket.port".sprintf("%04d",$no).".".$i."-".($i+$filesize).".tmp", "wb");
      fwrite($fp2, $file, $filesize);
      fclose($fp2);
      $i+=$filesize+1;
    $no++;
    }

    fclose($fp);

merge.php


    <?php
    $filelist = glob('./split/*socket*.tmp');
    $filesize = 10;

    //print_r($filelist);
    $mergeFileName = 'merg.zip';

    unlink($mergeFileName);
      $fp2 = fopen($mergeFileName,"w+");
    foreach($filelist as $k => $v)
    {
      $fp = fopen($v, "rb");
       $content = fread($fp, $filesize);

       fwrite($fp2, $content, $filesize);
       unset($content);
       fclose($fp);
       echo $k,"\n";
    }
      fclose($fp2);

ÒÔÉϾÍÊDZ¾ÎĵÄÈ«²¿ÄÚÈÝ£¬Ï£Íu¶Ô´o¼ÒµÄѧϰÓÐËu°iÖu£¬Ò²Ï£Íu´o¼Ò¶a¶aÖ§³Ö½Å±¾Ö®¼Ò¡£

 相关文章:
PHP分页显示制作详细讲解
SSH 登录失败:Host key verification failed
获取IMSI
将二进制数据转为16进制以便显示
获取IMEI
文件下载
贪吃蛇
双位运算符
PHP自定义函数获取搜索引擎来源关键字的方法
Java生成UUID
发送邮件
年的日历图
提取后缀名
在Zeus Web Server中安装PHP语言支持
让你成为最历害的git提交人
Yii2汉字转拼音类的实例代码
再谈PHP中单双引号的区别详解
指定应用ID以获取对应的应用名称
Python 2与Python 3版本和编码的对比
php封装的page分页类完整实例