本文整理匯總了PHP中Horde_Util::_shutdownreg方法的典型用法代碼示例。如果您正苦於以下問題:PHP Horde_Util::_shutdownreg方法的具體用法?PHP Horde_Util::_shutdownreg怎麽用?PHP Horde_Util::_shutdownreg使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類Horde_Util
的用法示例。
在下文中一共展示了Horde_Util::_shutdownreg方法的1個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。
示例1: deleteAtShutdown
/**
* Removes given elements at request shutdown.
*
* If called with a filename will delete that file at request shutdown; if
* called with a directory will remove that directory and all files in that
* directory at request shutdown.
*
* If called with no arguments, return all elements to be deleted (this
* should only be done by Horde_Util::_deleteAtShutdown()).
*
* The first time it is called, it initializes the array and registers
* Horde_Util::_deleteAtShutdown() as a shutdown function - no need to do
* so manually.
*
* The second parameter allows the unregistering of previously registered
* elements.
*
* @param string $filename The filename to be deleted at the end of the
* request.
* @param boolean $register If true, then register the element for
* deletion, otherwise, unregister it.
* @param boolean $secure If deleting file, should we securely delete
* the file?
*/
public static function deleteAtShutdown($filename, $register = true, $secure = false)
{
/* Initialization of variables and shutdown functions. */
if (!self::$_shutdownreg) {
register_shutdown_function(array(__CLASS__, 'shutdown'));
self::$_shutdownreg = true;
}
$ptr =& self::$_shutdowndata;
if ($register) {
if (@is_dir($filename)) {
$ptr['dirs'][$filename] = true;
} else {
$ptr['files'][$filename] = true;
}
if ($secure) {
$ptr['secure'][$filename] = true;
}
} else {
unset($ptr['dirs'][$filename], $ptr['files'][$filename], $ptr['secure'][$filename]);
}
}