当前位置: 首页>>代码示例>>PHP>>正文


PHP FileBackend::streamFile方法代码示例

本文整理汇总了PHP中FileBackend::streamFile方法的典型用法代码示例。如果您正苦于以下问题:PHP FileBackend::streamFile方法的具体用法?PHP FileBackend::streamFile怎么用?PHP FileBackend::streamFile使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在FileBackend的用法示例。


在下文中一共展示了FileBackend::streamFile方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: streamFileWithStatus

 /**
  * Attempt to stream a file with the given virtual URL/storage path
  *
  * @param string $virtualUrl
  * @param array $headers Additional HTTP headers to send on success
  * @param array $optHeaders HTTP request headers (if-modified-since, range, ...)
  * @return Status
  * @since 1.27
  */
 public function streamFileWithStatus($virtualUrl, $headers = [], $optHeaders = [])
 {
     $path = $this->resolveToStoragePath($virtualUrl);
     $params = ['src' => $path, 'headers' => $headers, 'options' => $optHeaders];
     $status = $this->newGood();
     $status->merge($this->backend->streamFile($params));
     return $status;
 }
开发者ID:paladox,项目名称:mediawiki,代码行数:17,代码来源:FileRepo.php

示例2: doTestStreamFileRange

 private function doTestStreamFileRange()
 {
     $backendName = $this->backendClass();
     $base = self::baseStorePath();
     $path = "{$base}/unittest-cont1/e/b/z/range_file.txt";
     $content = "0123456789ABCDEF";
     $this->prepare(['dir' => dirname($path)]);
     $status = $this->create(['dst' => $path, 'content' => $content]);
     $this->assertGoodStatus($status, "Creation of file at {$path} succeeded ({$backendName}).");
     static $ranges = ['bytes=0-0' => '0', 'bytes=0-3' => '0123', 'bytes=4-8' => '45678', 'bytes=15-15' => 'F', 'bytes=14-15' => 'EF', 'bytes=-5' => 'BCDEF', 'bytes=-1' => 'F', 'bytes=10-16' => 'ABCDEF', 'bytes=10-99' => 'ABCDEF'];
     foreach ($ranges as $range => $chunk) {
         ob_start();
         $this->backend->streamFile(['src' => $path, 'headless' => 1, 'allowOB' => 1, 'options' => ['range' => $range]]);
         $data = ob_get_contents();
         ob_end_clean();
         $this->assertEquals($chunk, $data, "Correct chunk streamed from '{$path}' for '{$range}'");
     }
 }
开发者ID:paladox,项目名称:mediawiki,代码行数:18,代码来源:FileBackendTest.php

示例3: streamFile

 /**
  * Attempt to stream a file with the given virtual URL/storage path
  *
  * @param $virtualUrl string
  * @param $headers Array Additional HTTP headers to send on success
  * @return bool Success
  */
 public function streamFile($virtualUrl, $headers = array())
 {
     $path = $this->resolveToStoragePath($virtualUrl);
     $params = array('src' => $path, 'headers' => $headers);
     return $this->backend->streamFile($params)->isOK();
 }
开发者ID:Tjorriemorrie,项目名称:app,代码行数:13,代码来源:FileRepo.php

示例4: streamFileWithStatus

 /**
  * Attempt to stream a file with the given virtual URL/storage path
  *
  * @param string $virtualUrl
  * @param array $headers Additional HTTP headers to send on success
  * @return Status
  * @since 1.27
  */
 public function streamFileWithStatus($virtualUrl, $headers = [])
 {
     $path = $this->resolveToStoragePath($virtualUrl);
     $params = ['src' => $path, 'headers' => $headers];
     return $this->backend->streamFile($params);
 }
开发者ID:claudinec,项目名称:galan-wiki,代码行数:14,代码来源:FileRepo.php


注:本文中的FileBackend::streamFile方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。