本文整理匯總了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());
}