本文整理匯總了PHP中phpbb\db\driver\driver_interface::get_sql_time方法的典型用法代碼示例。如果您正苦於以下問題:PHP driver_interface::get_sql_time方法的具體用法?PHP driver_interface::get_sql_time怎麽用?PHP driver_interface::get_sql_time使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類phpbb\db\driver\driver_interface
的用法示例。
在下文中一共展示了driver_interface::get_sql_time方法的1個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。
示例1: phpbb_generate_debug_output
/**
* Generate the debug output string
*
* @param \phpbb\db\driver\driver_interface $db Database connection
* @param \phpbb\config\config $config Config object
* @param \phpbb\auth\auth $auth Auth object
* @param \phpbb\user $user User object
* @param \phpbb\event\dispatcher_interface $phpbb_dispatcher Event dispatcher
* @return string
*/
function phpbb_generate_debug_output(\phpbb\db\driver\driver_interface $db, \phpbb\config\config $config, \phpbb\auth\auth $auth, \phpbb\user $user, \phpbb\event\dispatcher_interface $phpbb_dispatcher)
{
$debug_info = array();
// Output page creation time
if (defined('PHPBB_DISPLAY_LOAD_TIME')) {
if (isset($GLOBALS['starttime'])) {
$totaltime = microtime(true) - $GLOBALS['starttime'];
$debug_info[] = sprintf('<abbr title="SQL time: %.3fs / PHP time: %.3fs">Time: %.3fs</abbr>', $db->get_sql_time(), $totaltime - $db->get_sql_time(), $totaltime);
}
$debug_info[] = sprintf('<abbr title="Cached: %d">Queries: %d</abbr>', $db->sql_num_queries(true), $db->sql_num_queries());
$memory_usage = memory_get_peak_usage();
if ($memory_usage) {
$memory_usage = get_formatted_filesize($memory_usage);
$debug_info[] = 'Peak Memory Usage: ' . $memory_usage;
}
}
if (defined('DEBUG')) {
$debug_info[] = 'GZIP: ' . ($config['gzip_compress'] && @extension_loaded('zlib') ? 'On' : 'Off');
if ($user->load) {
$debug_info[] = 'Load: ' . $user->load;
}
if ($auth->acl_get('a_')) {
$debug_info[] = '<a href="' . build_url() . '&explain=1">SQL Explain</a>';
}
}
/**
* Modify debug output information
*
* @event core.phpbb_generate_debug_output
* @var array debug_info Array of strings with debug information
*
* @since 3.1.0-RC3
*/
$vars = array('debug_info');
extract($phpbb_dispatcher->trigger_event('core.phpbb_generate_debug_output', compact($vars)));
return implode(' | ', $debug_info);
}