?> <p class="stats"> <?php echo __('Page rendered in'); ?> <?php echo execution_time(); ?> <?php echo __('seconds'); ?> | <?php echo __('Memory usage:'); ?> <?php echo memory_usage(); ?> </p> <?php } ?> <p id="site-links"> <?php echo __('You are currently logged in as'); ?> <a href="<?php echo get_url('user/edit/' . AuthUser::getId()); ?> "><?php echo AuthUser::getRecord()->name;
function db_profile() { // total query time $total = 0; $html = ''; $html .= '<table id="debug_table" class="debug">'; $html .= '<thead><tr><th>SQL</th><th>Bindings</th><th>Rows</th><th>Time</th></th></thead>'; $html .= '<tbody>'; foreach (Db::profile() as $row) { $html .= '<tr><td>' . $row['sql'] . '</td><td>' . implode(', ', $row['binds']) . '</td><td>' . $row['rows'] . '</td><td>' . $row['time'] . '</td></tr>'; $total += $row['time']; } $html .= '</tbody>'; $html .= '<tfoot>'; $html .= '<tr><td colspan="3"><strong>Query Time</strong></td><td>' . round($total, 4) . '</td></tr>'; $html .= '<tr><td colspan="3"><strong>Execution Time</strong></td><td>' . execution_time() . '</td></tr>'; $html .= '<tr><td colspan="3"><strong>Memory Usage</strong></td><td>' . memory_usage() . 'Kb</td></tr>'; $html .= '</tfoot>'; $html .= '</table>'; return $html; }
print <<<EOT <tr> <th colspan="4" class="th3">PHP配置參數</th> </tr> <tr> <td>参数名称</td> <td colspan="3"><input type="text" name="opName" size="40" /> <input type="submit" class="myButton" value="配置检测" name="act" /></td> </tr> EOT; if ("show" == $opReShow) { echo '<tr><td colspan="4">' . $opRe . '</td></tr>'; } print <<<EOT </table> EOT; //require(TZ_ROOT.'footer.php'); echo ' <table border="0" cellspacing="1" cellpadding="0" id="f3"> <tr> <td id="f31">Powered by</td> <td id="f32"><a href="', $mytz['url_2'], '" target="_blank"><b>', $mytz['url_1'], '</b></a> </td></tr> </table> <a id="bottom"></a> <div id="footer"> © ', date('Y', time()), ' PHP探针 <a href="', $mytz['url_2'], '" target="_blank">', $mytz['url_1'], '</a> ', $mytz['version'], ' All Rights Reserved.<br /> Processed in ', sprintf('%0.4f', microtime_float() - $time_start), ' seconds. ', memory_usage(), ' memory usage. </div> </div> </form> </body> </html>';
function db_profile() { // total query time $total = 0; $html = '<style>'; $html .= '.debug {display: none;font-size: 13px; margin-bottom: 1em;}'; $html .= '.debug td, .debug th {padding: 4px 6px; border-bottom: 1px solid #ddd;}'; $html .= '.debug th {font-weight: bold; text-align: center;}'; $html .= '.debug tfoot td:first-child {text-align: right;}'; $html .= '</style>'; $html .= '<table id="debug_table" class="debug">'; $html .= '<thead><tr><th>SQL</th><th>Bindings</th><th>Rows</th><th>Time</th></th></thead>'; $html .= '<tbody>'; foreach (Db::profile() as $row) { $html .= '<tr><td>' . $row['sql'] . '</td><td>' . implode(', ', $row['binds']) . '</td><td>' . $row['rows'] . '</td><td>' . $row['time'] . '</td></tr>'; $total += $row['time']; } $html .= '</tbody>'; $html .= '<tfoot>'; $html .= '<tr><td colspan="3"><strong>Query Time</strong></td><td>' . round($total, 4) . '</td></tr>'; $html .= '<tr><td colspan="3"><strong>Execution Time</strong></td><td>' . execution_time() . '</td></tr>'; $html .= '<tr><td colspan="3"><strong>Memory Usage</strong></td><td>' . memory_usage() . 'Kb</td></tr>'; $html .= '</tfoot>'; $html .= '</table>'; return $html; }
/** * Draw the output * * @param bool $return_string if true return a string else draw the page * @return string */ function draw($return_string = false) { $tpl = new View(); // assign all variable $tpl->assign($this->var); // - LOAD AREA ---- // wrap all the blocks in a load area if ($this->load_area_array) { foreach ($this->load_area_array as $load_area_name => $blocks_array) { $load_area[$load_area_name] = $this->_blocks_wrapper($blocks_array); } $tpl->assign("load_area", $load_area); } // ---------------- // - HEAD ------ $head = get_javascript() . get_style(); $tpl->assign("head", $head); // -------------- // - BENCHMARK ------ $tpl->assign("execution_time", timer()); $tpl->assign("memory_used", memory_usage()); $tpl->assign("loaded_controller", $this->loaded_controller); $tpl->assign("n_query", class_exists('db') ? db::get_executed_query() : null); // -------------- return $tpl->draw($this->page_layout, $return_string); }
System uptime: <?php $uptime = shell_exec("cut -d. -f1 /proc/uptime"); echo secondsToTime($uptime); ?> </p> <p> CPU usage: <?php $cpu_usage = cpu_usage(); echo "{$cpu_usage}%"; ?> </p> <p> CPU temperature: <?php $cpu_temp = cpu_temp(); echo "{$cpu_temp}"; ?> </p> <p> Memory usage: <?php $memory_usage = round(memory_usage()); echo "{$memory_usage}%"; ?> </p>
<table width="100%" class="inp"> <tr> <th colspan="4" class="ec">MySQL 测试结果</th> </tr> <?php $link = @mysql_connect($_POST['mysqlHost'], $_POST['mysqlUser'], $_POST['mysqlPassword']); $errno = mysql_errno(); if ($link) $str1 = '<span style="color: #008000; font-weight: bold;">OK</span> ('.mysql_get_server_info($link).')'; else $str1 = '<span style="color: #ff0000; font-weight: bold;">Failed</span><br />'.mysql_error(); ?> <tr> <td colspan="2" class="er" width="50%">MySQL <?=$_POST['mysqlHost']?></td> <td colspan="2" class="fl" width="50%"><?=$str1?></td> </tr> <tr> <td colspan="2" class="er">数据库 <?=$_POST['mysqlDb']?></td> <td colspan="2" class="fl"><?=(@mysql_select_db($_POST['mysqlDb'],$link))?'<span style="color: #008000; font-weight: bold;">OK</span>':'<span style="color: #ff0000; font-weight: bold;">Failed</span>'?></td> </tr> </table> <? } ?> <p style="color:#33384e;font-size:14px;text-align:center; margin-bottom:2px;"> <?php $up_time = sprintf('%0.6f', micro_time_float() - $up_start);?>页面执行时间 <?php echo $up_time?> 秒 消耗内存 <?php echo memory_usage();?> </p> <hr style="width:100%; color:#cdcdcd" noshade="noshade" size="1" /> <p style="color:#505050; font-size:14px; text-align:center;">©2014 <a href="http://bozoyan.com">Bozoyan.com</a> 版权所有</p> </div> </body> </html>
</tr> </table> <a name="w_php"></a> <table> <tr><th colspan="4">PHP相关参数</th></tr> <tr> <td width="32%">PHP信息(phpinfo):</td> <td width="18%"> <?php $phpSelf = $_SERVER[PHP_SELF] ? $_SERVER[PHP_SELF] : $_SERVER[SCRIPT_NAME]; $disFuns=get_cfg_var("disable_functions"); ?> <?php echo (false!==eregi("phpinfo",$disFuns))? '<font color="red">×</font>' :"<a href='$phpSelf?act=phpinfo' target='_blank'>PHPINFO</a>";?> </td> <td width="32%">PHP版本(php_version):</td>