Skip to content

Instantly share code, notes, and snippets.

View jshensh's full-sized avatar

403 Forbidden jshensh

  • 17:12 (UTC +08:00)
View GitHub Profile
@jshensh
jshensh / 断点续传.php
Last active August 3, 2017 17:10 — forked from HikoQiu/断点续传.php
PHP断点续传
// 下载
<?php
$file = './Penguins.jpg';
$file_display_name = basename($file);
$fsize = @filesize($file);
if (!empty($fsize)) {
$start = null;
$end = $fsize - 1;
if (isset($_SERVER['HTTP_RANGE']) && $_SERVER['HTTP_RANGE'] !== "" && preg_match("/^bytes=([0-9]+)-([0-9]*)$/i", $_SERVER['HTTP_RANGE'], $match) && $match[1] < $fsize && $match[2] < $fsize) {
$start = $match[1];