emlog添加页面加载耗时和调用数据库次数

sjcx.png

1.打开module.php文件,添加以下代码:

<?php
// 添加开始时间函数
function runStartTime(){
 define('RUN_STARTTIME', microtime(true));
}
// 计算耗时和查询数据库次数并输出函数
function setAndShowFoot(){
 $runStopTime = microtime(true);
 $timeCount = round($runStopTime - RUN_STARTTIME, 3);  $databaseLink = MySql::getInstance();
 $queryNum = $databaseLink->getQueryCount();
 echo "<a>页面加载耗时:<font color=\"#FF3737\">".$timeCount."</font>秒</span> <a>调用数据库:<font color=\"#FF3737\">".$queryNum."</font>次</a>";
}
?>

2.把开始时间函数放到模板的header.php文件的最下面,即在 header.php 底部添加如下代码: 
<?php runStartTime(); ?>
3.最后就是输出了,打开 footer.php 文件,在适当的位置添加输出代码:
<?php setAndShowFoot(); ?>
本博客所有文章如无特别注明均为原创。作者:流年复制或转载请以超链接形式注明转自 流年博客
原文地址《emlog添加页面加载耗时和调用数据库次数
分享到:更多

相关推荐

发表评论

路人甲 表情
Ctrl+Enter快速提交

网友评论(110)

<a href="http://ventolin.irish/">ventolin</a> <a href="http://cytotec.us.org/">cytotec pills</a> <a href="http://wellbutrinxr.com/">wellbutrin</a> <a href="http://buycialis.club/">cialis</a> <a href="http://iraqdevelopmentprogram.org/">vardenafil without a prescription</a>
<a href="http://bupropion.wtf/">bupropion</a> <a href="http://buyabilify.us.com/">buy abilify</a>
<a href="http://buynexium.us.org/">nexium tablets</a> <a href="http://allopurinol.recipes/">allopurinol</a> <a href="http://flagyl.company/">flagyl 500 mg</a> <a href="http://buycytotec.us.com/">cytotec offers</a> <a href="http://antabuse.recipes/">antabuse</a> <a href="http://antihypertensionmeds.com/">furosemide iv</a> <a href="http://traitsjs.org/">indocin without a prescription</a> <a href="http://buyretinaonlinenoprescription.com/">found it for you</a>
<a href="http://buytenormin.us.com/">buy tenormin</a> <a href="http://cialis18.us.com/">ciallis</a> <a href="http://albendazole.club/">albendazole</a> <a href="http://buybupropion.us.org/">bupropion 150 mg</a> <a href="http://buysildenafil.ooo/">sildenafil</a> <a href="http://buymedrol.us.com/">Medrol Without Prescription</a> <a href="http://buyampicillin.us.com/">buy ampicillin</a> <a href="http://traitsjs.org/">indocin 50 mg</a> <a href="http://lincspanishschool.com/">doxycycline</a> <a href="http://indocin.us.org/">INDOCIN 50 MG</a>
<a href="http://buyamitriptyline.us.com/">generic amitriptyline</a>
<a href="http://cymbalta.company/">cost of cymbalta</a>
<a href="http://amoxicillingeneric.com/">buy amoxicillin</a>
trackback lascia un commento cialis
http://tadalafilatwalmart.net - cialis over the counter at walmart
  generico cialis
<a href="http://tadalafilatwalmart.net">cialis over the counter at walmart
</a> - uk pharmacy online cialis
levitra vs cialis vs viagra weight loss rbook.cgi?page=
<a href="http://gracefulurls.com/">metformin</a>
<a href="http://zithromax.run/">extra resources</a> <a href="http://lisinopril.wtf/">lisinopril</a> <a href="http://buyalbuterol.ooo/">buy albuterol</a> <a href="http://mobic.us.com/">mobic 7.5</a>
<a href="http://amoxicillin.wtf/">where can i buy amoxicillin online</a> <a href="http://artvinansiklopedisi.com/">continue reading</a>
<a href="http://allopurinol.us.org/">order allopurinol</a>
<a href="http://diflucan.recipes/">buy duflican</a>
<a href="http://cymbalta60.com/">generic cymbalta 60 mg</a> <a href="http://doxycycline.irish/">doxycycline cheap</a> <a href="http://fluoxetine.us.org/">Fluoxetine</a> <a href="http://propecia4you.us.com/">propecia 5 mg for sale</a> <a href="http://celexa.company/">cheap celexa online</a> <a href="http://tretinoin.club/">tretinoin cream</a> <a href="http://viagra.us.org/">sildenafil no rx</a> <a href="http://cost-of-viagra.com/">Cost Of Viagra</a> <a href="http://carnivalcruiseblog.com/">lasix 20mg</a>
<a href="http://buyvardenafil.ooo/">buy vardenafil</a>
1 2 3 4 5 6 ... »