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


PHP File::openFile方法代码示例

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


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

示例1: __construct

 /**
  * Class constructor.
  *
  * @param \Symfony\Component\HttpFoundation\File\File $info
  * @param string                                      $mime_type
  * @param string                                      $extension
  */
 public function __construct(SymfonyFile $info, $mime_type = null, $extension = null)
 {
     // Symfony will help us guess things about this file
     $this->info = $info;
     // Sometimes we want to specify the MIME type ourselves
     $this->mime_type = $mime_type;
     // Sometimes we want to specify the extension ourselves
     $this->extension = $extension;
     // Get the SplFileObject from the SplFileInfo
     $this->object = $this->info->openFile();
     // Kill any temporary files created in the lifetime of this object
     register_shutdown_function([$this, 'unlink']);
 }
开发者ID:fuzz-productions,项目名称:image-resizer,代码行数:20,代码来源:File.php

示例2: __construct

 /**
  * Constructor
  *
  * @param string $streetNames Path of the file containing the street names
  */
 public function __construct($streetNames)
 {
     $file = new File($streetNames);
     $splFileObject = $file->openFile('r');
     while (!$splFileObject->eof()) {
         $this->streetNames[] = trim($splFileObject->fgets());
     }
 }
开发者ID:r1pp3rj4ck,项目名称:r1pp3rj4ckLipsumBundle,代码行数:13,代码来源:AddressGenerator.php

示例3: populateNames

 /**
  * Populate names from file to an array
  *
  * @param string $filename File name containing the names
  *
  * @return array
  * @author r1pp3rj4ck <attila.bukor@gmail.com>
  */
 private function populateNames($filename)
 {
     $names = array();
     $file = new File($filename);
     $splFileObject = $file->openFile('r');
     while (!$splFileObject->eof()) {
         $names[] = trim($splFileObject->fgets());
     }
     return $names;
 }
开发者ID:r1pp3rj4ck,项目名称:r1pp3rj4ckLipsumBundle,代码行数:18,代码来源:ProfileGenerator.php


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