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


PHP SplFileObject::__construct方法代码示例

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


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

示例1: __construct

 public function __construct($filename, $context)
 {
     // Call parent
     parent::__construct($filename);
     // Pass image context
     $this->setContext($context);
 }
开发者ID:yanahiro,项目名称:php-passbook,代码行数:7,代码来源:Image.php

示例2: __construct

 public function __construct($filename)
 {
     try {
         parent::__construct($filename);
     } catch (\RuntimeException $e) {
         throw new FileNotFoundException($filename);
     }
 }
开发者ID:yanahiro,项目名称:php-passbook,代码行数:8,代码来源:Certificate.php

示例3: __construct

 public function __construct($filename, $mode = 'r', $use_include_path = false, $context = null)
 {
     parent::__construct($filename);
     $this->setFlags(SplFileObject::READ_CSV);
     $this->setCsvControl($this->_delimiter, $this->_enclosure);
     $this->rewind();
     $this->_map = parent::current();
 }
开发者ID:nstapelbroek,项目名称:Glitch_Lib,代码行数:8,代码来源:Csv.php

示例4: __construct

 /**
  * ( excerpt from http://php.net/manual/en/spltempfileobject.construct.php
  * )
  *
  * Construct a new temporary file object.
  *
  * @maxMemory  mixed   The maximum amount of memory (in bytes, default is 2
  *                     MB) for the temporary file to use. If the temporary
  *                     file exceeds this size, it will be moved to a file
  *                     in the system's temp directory.
  *
  *                     If max_memory is negative, only memory will be
  *                     used. If max_memory is zero, no memory will be used.
  *
  * @return     mixed   No value is returned.
  */
 public function __construct($maxMemory = null)
 {
     if ($maxMemory === null) {
         parent::__construct('php://temp', 'r+');
     } else {
         parent::__construct("php://temp/maxmemory:{$maxMemory}", 'r+');
     }
 }
开发者ID:badlamer,项目名称:hhvm,代码行数:24,代码来源:SplTempFileObject.php

示例5: __construct

 /**
  * @param string $filename
  * @param int $columnTitlesIndex
  * @param string $open_mode
  * @param bool $use_include_path
  * @param null $context
  */
 public function __construct($filename, $columnTitlesIndex = -1, $open_mode = 'r', $use_include_path = false, $context = null)
 {
     $this->columnTitlesIndex = $columnTitlesIndex;
     if (is_null($context)) {
         parent::__construct($filename, $open_mode, $use_include_path);
     } else {
         parent::__construct($filename, $open_mode, $use_include_path, $context);
     }
 }
开发者ID:rskuipers,项目名称:csv,代码行数:16,代码来源:File.php

示例6: tempnam

 /**
  * @constructor
  *
  * @param {?string} $defaultContentType Default mimetype of the uploading file,
  *                                      when finfo failed in guessing one.
  */
 function __construct($defaultContentType = 'application/octet-stream')
 {
     if ($defaultContentType) {
         $this->defaultContentType = $defaultContentType;
     }
     $file = tempnam(sys_get_temp_dir(), 'tmp.');
     stream_copy_to_stream(fopen('php://input', 'r'), fopen($file, 'r'));
     parent::__construct($file);
 }
开发者ID:Victopia,项目名称:prefw,代码行数:15,代码来源:RequestPutFile.php

示例7: __construct

 public function __construct($filename, $openMode = 'r', $useIncludePath = 'false', $context = null)
 {
     if (isset($context)) {
         parent::__construct($filename, $openMode, $useIncludePath, $context);
     } else {
         parent::__construct($filename, $openMode, $useIncludePath);
     }
     $this->setFileClass('Stalxed\\FileSystem\\FileObject');
     $this->setInfoClass('Stalxed\\FileSystem\\FileInfo');
 }
开发者ID:stalxed,项目名称:filesystem,代码行数:10,代码来源:FileObject.php

示例8: __construct

 /**
  * CsvFileReader constructor.
  *
  * @param string|File $filePath CSVファイルのFileインスタンスかファイルパス
  */
 public function __construct($filePath)
 {
     if (is_a($filePath, 'File')) {
         $filePath = $filePath->path;
     }
     $tmp = NetCommonsFile::getTemporaryFileConvertSjisWin2Utf8($filePath);
     $path = $tmp->path;
     parent::__construct($path);
     $this->setFlags(SplFileObject::READ_CSV);
 }
开发者ID:s-nakajima,项目名称:files,代码行数:15,代码来源:CsvFileReader.php

示例9: catch

 /**
  * Creates an extended SplFileObject from the given filename, which
  * prevents against null byte injections and unprintable characters.
  *
  * @param string $path the path to the file (path && file name)
  *
  * @return does not return a value.
  */
 function __construct($path)
 {
     try {
         @parent::__construct($path);
     } catch (Exception $e) {
         throw new EnterpriseSecurityException('Failed to open stream', 'Failed to open stream ' . $e->getMessage());
     }
     $this->_doDirCheck($path);
     $this->_doFileCheck($path);
     $this->_doExtraCheck($path);
 }
开发者ID:AnvilStriker,项目名称:owasp-esapi-php,代码行数:19,代码来源:SafeFile.php

示例10:

 /**
  * @constructor
  *
  * @param {array|string} Either path to target file, or an array in $_FILES format.
  */
 function __construct($file, $open_mode = 'r', $use_include_path = false, $resource = null)
 {
     if (is_array($file)) {
         // POST filename
         if (trim(@$file['name'])) {
             $this->filename = $file['name'];
         }
         $filename = $file['tmp_name'];
     } else {
         $filename = (string) $file;
     }
     parent::__construct($filename, $open_mode, $use_include_path, $resource);
 }
开发者ID:Victopia,项目名称:prefw,代码行数:18,代码来源:RequestPostFile.php

示例11: __construct

 public function __construct($path, $mime_type = null, $width = null, $height = null)
 {
     if (!is_file($path)) {
         throw new \Exception('File not found : ' . $path);
     }
     parent::__construct($path);
     $this->findMimeType($path);
     $this->mimeType = $mime_type ?: $this->findMimeType($path);
     if (in_array($this->mimeType, $this->resizableMimeType)) {
         $this->width = $width;
         $this->height = $height;
     }
 }
开发者ID:smallsnailbigdream,项目名称:evernote-cloud-sdk-php,代码行数:13,代码来源:File.php

示例12: __construct

 /**
  * Konstruktor
  * @param string $path Pfad zu der Datei
  * @param int $line_start_position
  * @param null $line_end_position
  * @throws FileException
  */
 public function __construct($path, $line_start_position = 0, $line_end_position = null)
 {
     if (!is_string($path)) {
         throw new \InvalidArgumentException('File: $path not a string');
     }
     $this->path = $path;
     try {
         parent::__construct($path);
     } catch (Exception $e) {
         throw new FileNotReadableException($message = 'File can not read', $code = 100, $previous = $e);
     }
     $this->line_start_position = $line_start_position;
     $this->line_end_position = $line_end_position;
 }
开发者ID:Talk-Point,项目名称:TPFoundation,代码行数:21,代码来源:File.php

示例13: __construct

 /**
  * See the documentation for SplFileObject
  *
  * @return this
  **/
 public function __construct($filename, $openMode, $useIncludePath, $context)
 {
     // construct per the parent constructor
     if (empty($context)) {
         // stinking annoying PHP gotchas
         parent::__construct($filename, $openMode, $useIncludePath);
     } else {
         parent::__construct($filename, $openMode, $useIncludePath, $context);
     }
     // set default CSV options
     $this->setFlags(SplFileObject::READ_CSV);
     // return
     return $this;
 }
开发者ID:Vci,项目名称:Libs,代码行数:19,代码来源:Filter.php

示例14: __construct

	/**
	 * Construct a new file object and set defaults.
	 *
	 * @param string $file
	 * @param string $mode
	 * @param bool $include
	 * @param stream $context
	 * @return Interspire_File
	 */
	public function __construct($file, $mode = 'r', $include = false, $context = null)
	{
		if ($context) {
			parent::__construct($file, $mode, $include, $context);
		}
		else {
			parent::__construct($file, $mode, $include);
		}

		if (method_exists('SplFileObject', 'getRealPath')) {
			// getRealPath is PHP >= 5.2.2
			$this->realpath = parent::getRealPath();
		} else {
			$this->realpath = realpath($file);
		}
	}
开发者ID:hungnv0789,项目名称:vhtm,代码行数:25,代码来源:File.php

示例15: __construct

 public function __construct($filename = null, $open_mode = "a")
 {
     $filename = $filename ?: APP_PATH . "/log" . DS . \Yaf\ENVIRON . ".log";
     parent::__construct($filename, $open_mode);
 }
开发者ID:randy-ran,项目名称:yaf_base_application,代码行数:5,代码来源:Logger.php


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