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