try { a(); } catch (Exception $e) { debug('Captured exception 1: "' . $e->getMessage() . '"'); try { b(); } catch (Exception $e) { debug('Captured exception 2: "' . $e->getMessage() . '"'); } } $array = array(null, false, true, 1, 3.1415, 'hello', ''); foreach ($array as $value) { debug($value, true, 'VALUE:: '); $debugString = debug($value, false, 'VAL:: '); unreal4u\debugInfo::debugFirePHP($value); print $debugString; } $nestedArray = $array; $nestedArray['more'] = $array; $nestedArray['more']['more'] = $array; debug($array); debug($nestedArray); $writtenToFile = debugFile($array, '', '/tmp/'); debug($writtenToFile, true, 'Written to file: '); print $debugInfo; unreal4u\debugInfo::debugFirePHP($array); $debugInfo->endCounter('beginScript'); printf('Terminating the script... Total time: '); debug($debugInfo->getDiff('beginScript', 'all')); printf('The exact timestamp at which this script ended is %.4f (%s) and we are using %s of memory', getExactTime(), $debugInfo::convertTimestamp(getExactTime()), $debugInfo->getMemoryUsage('kib', true)); ob_end_flush();
/** * 删除目录(即使目录不为空) * * @param $path * @return bool */ function deleteTree($path) { if (empty($path)) { return false; } debugFile($path, 'deltree.txt'); if (!\is_dir($path)) { if (\is_file($path)) { unlink($path); } } else { $dh = \opendir($path); while ($file = \readdir($dh)) { if ($file != '.' && $file != '..') { deltree($path . $file); } } \closedir($dh); \rmdir($path); } }