本文整理汇总了PHP中debug_guard函数的典型用法代码示例。如果您正苦于以下问题:PHP debug_guard函数的具体用法?PHP debug_guard怎么用?PHP debug_guard使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了debug_guard函数的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: html_debug
/**
* prints some debug info
*
* @author Andreas Gohr <andi@splitbrain.org>
*/
function html_debug()
{
global $conf;
global $lang;
/** @var DokuWiki_Auth_Plugin $auth */
global $auth;
global $INFO;
//remove sensitive data
$cnf = $conf;
debug_guard($cnf);
$nfo = $INFO;
debug_guard($nfo);
$ses = $_SESSION;
debug_guard($ses);
print '<html><body>';
print '<p>When reporting bugs please send all the following ';
print 'output as a mail to andi@splitbrain.org ';
print 'The best way to do this is to save this page in your browser</p>';
print '<b>$INFO:</b><pre>';
print_r($nfo);
print '</pre>';
print '<b>$_SERVER:</b><pre>';
print_r($_SERVER);
print '</pre>';
print '<b>$conf:</b><pre>';
print_r($cnf);
print '</pre>';
print '<b>DOKU_BASE:</b><pre>';
print DOKU_BASE;
print '</pre>';
print '<b>abs DOKU_BASE:</b><pre>';
print DOKU_URL;
print '</pre>';
print '<b>rel DOKU_BASE:</b><pre>';
print dirname($_SERVER['PHP_SELF']) . '/';
print '</pre>';
print '<b>PHP Version:</b><pre>';
print phpversion();
print '</pre>';
print '<b>locale:</b><pre>';
print setlocale(LC_ALL, 0);
print '</pre>';
print '<b>encoding:</b><pre>';
print $lang['encoding'];
print '</pre>';
if ($auth) {
print '<b>Auth backend capabilities:</b><pre>';
foreach ($auth->getCapabilities() as $cando) {
print ' ' . str_pad($cando, 16) . ' => ' . (int) $auth->canDo($cando) . NL;
}
print '</pre>';
}
print '<b>$_SESSION:</b><pre>';
print_r($ses);
print '</pre>';
print '<b>Environment:</b><pre>';
print_r($_ENV);
print '</pre>';
print '<b>PHP settings:</b><pre>';
$inis = ini_get_all();
print_r($inis);
print '</pre>';
if (function_exists('apache_get_version')) {
$apache = array();
$apache['version'] = apache_get_version();
if (function_exists('apache_get_modules')) {
$apache['modules'] = apache_get_modules();
}
print '<b>Apache</b><pre>';
print_r($apache);
print '</pre>';
}
print '</body></html>';
}
示例2: html_debug
/**
* prints some debug info
*
* @author Andreas Gohr <andi@splitbrain.org>
*/
function html_debug()
{
global $conf;
global $lang;
global $auth;
global $INFO;
//remove sensitive data
$cnf = $conf;
debug_guard($cnf);
$nfo = $INFO;
debug_guard($nfo);
$ses = $_SESSION;
debug_guard($ses);
print '<html><body>';
print '<p>When reporting bugs please send all the following ';
print 'output as a mail to andi@splitbrain.org ';
print 'The best way to do this is to save this page in your browser</p>';
print '<b>$INFO:</b><pre>';
print_r($nfo);
print '</pre>';
print '<b>$_SERVER:</b><pre>';
print_r($_SERVER);
print '</pre>';
print '<b>$conf:</b><pre>';
print_r($cnf);
print '</pre>';
print '<b>DOKU_BASE:</b><pre>';
print DOKU_BASE;
print '</pre>';
print '<b>abs DOKU_BASE:</b><pre>';
print DOKU_URL;
print '</pre>';
print '<b>rel DOKU_BASE:</b><pre>';
print dirname($_SERVER['PHP_SELF']) . '/';
print '</pre>';
print '<b>PHP Version:</b><pre>';
print phpversion();
print '</pre>';
print '<b>locale:</b><pre>';
print setlocale(LC_ALL, 0);
print '</pre>';
print '<b>encoding:</b><pre>';
print $lang['encoding'];
print '</pre>';
if ($auth) {
print '<b>Auth backend capabilities:</b><pre>';
print_r($auth->cando);
print '</pre>';
}
print '<b>$_SESSION:</b><pre>';
print_r($ses);
print '</pre>';
print '<b>Environment:</b><pre>';
print_r($_ENV);
print '</pre>';
print '<b>PHP settings:</b><pre>';
$inis = ini_get_all();
print_r($inis);
print '</pre>';
print '</body></html>';
}
示例3: debug_guard
/**
* Remove all data from an array where the key seems to point to sensitive data
*
* This is used to remove passwords, mail addresses and similar data from the
* debug output
*
* @author Andreas Gohr <andi@splitbrain.org>
*/
function debug_guard(&$data)
{
foreach ($data as $key => $value) {
if (preg_match('/(notify|pass|auth|secret|ftp|userinfo|token|buid|mail|proxy)/i', $key)) {
$data[$key] = '***';
continue;
}
if (is_array($value)) {
debug_guard($data[$key]);
}
}
}