當前位置: 首頁>>代碼示例>>PHP>>正文


PHP ezcMailParser::getTmpDir方法代碼示例

本文整理匯總了PHP中ezcMailParser::getTmpDir方法的典型用法代碼示例。如果您正苦於以下問題:PHP ezcMailParser::getTmpDir方法的具體用法?PHP ezcMailParser::getTmpDir怎麽用?PHP ezcMailParser::getTmpDir使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在ezcMailParser的用法示例。


在下文中一共展示了ezcMailParser::getTmpDir方法的2個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。

示例1: openFile

 /**
  * Returns the filepointer of the opened file $fileName in a unique directory..
  *
  * This method will create a new unique folder in the temporary directory specified in ezcMailParser.
  * The fileName property of this class will be set to the location of the new file.
  *
  * @throws ezcBaseFileNotFoundException
  *         if the file could not be opened.
  * @param string $fileName
  * @return resource
  */
 private function openFile($fileName)
 {
     // The filename is now relative, we need to extend it with the absolute path.
     // To provide uniqueness we put the file in a directory based on processID and rand.
     $dirName = ezcMailParser::getTmpDir() . getmypid() . '-' . self::$counter++ . '/';
     if (!is_dir($dirName)) {
         mkdir($dirName, 0700);
     }
     // remove the directory and the file when PHP shuts down
     ezcMailParserShutdownHandler::registerForRemoval($dirName);
     $this->fileName = $dirName . $fileName;
     $fp = fopen($this->fileName, 'w');
     if ($this->fp === false) {
         throw new ezcBaseFileNotFoundException($this->fileName);
     }
     return $fp;
 }
開發者ID:kidaa30,項目名稱:yes,代碼行數:28,代碼來源:file_parser.php

示例2: testTempDirNonWindows

 /**
  * Test for bug #12844.
  */
 public function testTempDirNonWindows()
 {
     if (ezcBaseFeatures::os() === 'Windows') {
         self::markTestSkipped('Test is for non-Windows only');
     }
     ezcMailParser::setTmpDir(null);
     $this->assertEquals('/tmp/', ezcMailParser::getTmpDir());
 }
開發者ID:bmdevel,項目名稱:ezc,代碼行數:11,代碼來源:parser_test.php


注:本文中的ezcMailParser::getTmpDir方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。