本文整理汇总了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;
}
示例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());
}