獲取遠端大檔案部分內容的方法

2021-09-08 21:46:40 字數 1612 閱讀 7923

獲取遠端大檔案部分內容的方法

一些其它介紹可以移步:

或者直接檢視rfc

我們使用檔案記錄上次訪問的位置,下次直接從這個位置訪問

使用php的fsockopen函式實現獲取大檔案部分內容的**如下:

123

4567

891011

1213

1415

1617

1819

2021

2223

2425

2627

2829

3031

3233

3435

3637

3839

4041

4243

4445

4647

4849

5051

5253

5455

5657

5859

60

<?php

header("content-type:text/html;charset=utf-8");

$host = "downloads.php.net";

$port = 80;

$path = "/johannes/php-5.3.1rc1.tar.bz2";

$start = 0;

$length = 100;

$content = get_remote_content($host, $port, $path, $start, $length);

$content_length = strlen($content);

if (!empty($content))

}}echo $content;

//echo xdebug_time_index();

die();  

/*** 獲取遠端檔案內容

* @param $host 主機

* @param $port 埠

* @param $path 路徑

* @param $start 開始位置

* @return 遠端部分內容

$out .= "range:bytes=" .$range . "\r\n"; // 取start之後的內容

$out .= "connection: close\r\n\r\n";

fwrite($fp, $out);

$buffer = '';

while (!feof($fp))

return $buffer;

}

獲取遠端大檔案部分內容的方法    文章出處:

php原始碼閱讀,php設計模式,php學習筆記,專案管理-胖胖的空間

R基礎 如何讀取大檔案的部分內容

同理心 樣本大概是10,5,35個,考慮到人類的基因大概有2w多個,那麼這就是乙個10000 x 20000的大樣本資料,鑑於這還是乙個tpm,資料型別是浮點型,檔案解壓縮之後就是4.61g,如果全部載入到r語言中,大部分的電腦估計都受不了 library pryr test object size...

C語言修改檔案某部分內容

兩種方法 1.全部讀入記憶體 修改後重新存入檔案 2.邊讀邊寫到另一新建檔案 要修改的部分修改後存入新建檔案 其他部分原封不動寫入 寫完刪掉原先檔案 將這個新的改為刪掉那個的名字 方法一 讀入記憶體修改 然後重新寫入檔案 include include main linedata 100 file ...

讀取csv檔案裡面部分內容(email,name)

static void main directoryinfo info new directoryinfo spath filesysteminfo fsinfo info.getfilesysteminfos filestream fs new filestream filename,system...