好!欢迎访问迷津渡口 现在时间是: 天气 °C ~ °C

迷津渡口

越感到迷惑 越接近真理

emlog输出页面加载耗时和查询数据库次数

为了更好的完善博客,了解网站打开的速度,大家可能想知道如何输出页面加载耗时和加载时查询数据库的次数。

下面又到了小指开课的时间了~

打开核心中的核心 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 "<span>页面加载耗时:<font color=\"#FF3737\">".$timeCount."</font>秒</span><span>查询数据库:<font color=\"#FF3737\">".$queryNum."</font>次</span>";
}
?>
下一步,把开始时间函数放到模板的 header.php 文件的最上面,即在 header.php 顶部添加如下代码:

<?php runStartTime(); ?>
最后就是输出了,打开 footer.php 文件,在最底部添加输出代码:

<?php setAndShowFoot(); ?>
搞定~



点赞3
   支持一下
挤眼 亲亲 咆哮 开心 想想 可怜 糗大了 委屈 哈哈 小声点 右哼哼 左哼哼 疑问 坏笑 赚钱啦 悲伤 耍酷 勾引 厉害 握手 耶 嘻嘻 害羞 鼓掌 馋嘴 抓狂 抱抱 围观 威武 给力
 点赞
 签到
 表情
 图片
 代码
提交评论

清空信息
关闭评论
brodiebaranow
 brodiebaranow 约 5 小时前回复
#138
<a href="http://www.lumalender.com/roshe-run-wei%C3%9F-flyknit-butya">roshe run wei脽 flyknit</a> <a href="http://www.millertiregi.com/mujeres-nike-kyrie-1-negro-gris-obuvc">mujeres nike kyrie 1 negro gris</a> <a href="http://www.bkgutters.com/salomon-xt-hornet-kaffe-scarpea">salomon xt hornet kaffe</a> <a href="http://www.celebritywm.com/mujeres-air-max-90-zapatilla-de-deporteboot-gris-oro-scarpee">mujeres air max 90 zapatilla de deporteboot gris oro</a> <a href="http://www.chachiscoffee.com/nike-free-tr-flyknit-5.0-orange-gul-obuvc">nike free tr flyknit 5.0 orange gul</a> <a href="http://www.flypiip.com/mujeres-nike-kyrie-2-rojo-rosado-scarpea">mujeres nike kyrie 2 rojo rosado</a>
brodiebaranow http://www.brodiebaranow.com/
leatherleif
 leatherleif 约 8 小时前回复
#137
<a href="http://www.rcnspecials.com/nike-free-5.0-hombres-corriendo-zapato-negro-schuhef">nike free 5.0 hombres corriendo zapato negro</a> <a href="http://www.aprancheta.com/kyrie-2-verde-nero-obuvg">kyrie 2 verde nero</a> <a href="http://www.getleanlearn.com/adidas-ultra-boost-bleu-vert-chaussuresa">adidas ultra boost bleu vert</a> <a href="http://www.hbshbuick.com/nike-roshe-run-mujeres-zapatos-oreos-todas-negro-blanco-hot-butya">nike roshe run mujeres zapatos oreos todas negro blanco hot</a> <a href="http://www.hvactampafl.com/herre-nike-air-max-90-vt-lilla-bl%C3%A5-obuvc">herre nike air max 90 vt lilla bl氓</a> <a href="http://www.zinmanlaw.com/adidas-superstar-r%C3%B8d-heart-point-scarpea">adidas superstar r酶d heart point</a>
leatherleif http://www.leatherleif.com/
landsmanbook
 landsmanbook 2019-03-19 06:42回复
#136
<a href="http://www.jazzoutlaw.com/yeezy-750-boost-solar-r%C3%B8d-for-salg-butyc">yeezy 750 boost solar r酶d for salg</a> <a href="http://www.fifteenforty.com/air-jordan-1-retro-bmp-gul-svart-scarpeb">air jordan 1 retro bmp gul svart</a> <a href="http://www.cagiad.com/nike-air-presto-svart-sko-kurpesf">nike air presto svart sko</a> <a href="http://www.magicwristlet.com/nike-blazer-blum%C3%A4nner-orange-rosa-scarpea">nike blazer blum盲nner orange rosa</a> <a href="http://www.fleksys.com/nike-air-max-tailwind-7-femmes-argent-noir-obuvb">nike air max tailwind 7 femmes argent noir</a> <a href="http://www.teamworkpress.com/nike-flyknit-lunar-1-herren-laufen-schuh-line-chaussuresd">nike flyknit lunar 1 herren laufen schuh line</a>
landsmanbook http://www.landsmanbook.com/
yeliseeva
 yeliseeva 2019-03-18 04:28回复
#135
<a href="http://www.keleric.com/nike-zoom-pegasus-33-kvinders-gul-bl%C3%A5-skoj">nike zoom pegasus 33 kvinders gul bl氓</a> <a href="http://www.jeffreya.com/nike-free-run-2-oro-grigio-scarpeq">nike free run 2 oro grigio</a> <a href="http://www.vuduchoan.com/nike-zoom-clear-out-pink-blue-shoesj">nike zoom clear out pink blue</a> <a href="http://www.gmfamilylaw.com/nike-air-max-thea-herre-fl%C3%A5den-bl%C3%A5-skop">nike air max thea herre fl氓den bl氓</a> <a href="http://www.clubephytus.com/nike-roshe-run-floral-himmelen-bl%C3%A5-rosa-obuvk">nike roshe run floral himmelen bl氓 rosa</a> <a href="http://www.findnewcoupon.com/nike-air-jordan-3-retro-fire-red-shoesi">nike air jordan 3 retro fire red</a>
yeliseeva http://www.yeliseeva.com/
conradtillard
 conradtillard 2019-03-17 09:55回复
#134
<a href="http://www.kelseybsbooks.com/nike-free-tr-dam%C3%A4nner-gelb-orange-chaussuresa">nike free tr dam盲nner gelb orange</a> <a href="http://www.michellestill.com/nike-kyrie-3-samurai-for-salg-vancouver-butya">nike kyrie 3 samurai for salg vancouver</a> <a href="http://www.relojesorion.com/air-jordan-1-hvit-r%C3%B8d-quilt-butyd">air jordan 1 hvit r酶d quilt</a> <a href="http://www.sarabeenie.com/adidas-protator-blau-and-rot-obuvg">adidas protator blau and rot</a> <a href="http://www.selfdriverbus.com/femmes-nike-free-3.0-gris-noir-kurpesa">femmes nike free 3.0 gris noir</a> <a href="http://www.waterlowcards.com/nike-lunarglide-femmes-wiggle-kurpesf">nike lunarglide femmes wiggle</a>
[url=http://www.conradtillard.com/]conradtillard[/url]
qubellinfo
 qubellinfo 2019-03-17 08:55回复
#133
<a href="http://www.joalby.com/ralph-lauren-black-watch-white-khaki-poloz">ralph lauren black watch white khaki</a> <a href="http://www.radiowizi.com/kobe-9-low-schwarz-and-gold-ring-chaussuresa">kobe 9 low schwarz and gold ring</a> <a href="http://www.rapamateur.com/jordan-11-hvid-galaxy-schuhee">jordan 11 hvid galaxy</a> <a href="http://www.tuartonline.com/nike-air-max-90-mujeres-blanco-negro-scarpea">nike air max 90 mujeres blanco negro</a> <a href="http://www.bantathlete.com/nike-air-max-2014-hvid-gr%C3%A5-kurpesf">nike air max 2014 hvid gr氓</a> <a href="http://www.clandessdiner.com/randy-moss-mens-limited-camo-jersey-nike-nfl-minnesota-vikings-2018-salute-to-service-84-nflr">randy moss mens limited camo jersey nike nfl minnesota vikings 2018 salute to service 84</a>
qubellinfo http://www.qubellinfo.com/
dakvideo
 dakvideo 2019-03-16 20:55回复
#132
<a href="http://www.germanxtube.com/nike-free-trainer-5.0-herre-hvid-skol">nike free trainer 5.0 herre hvid</a> <a href="http://www.eugenesklyar.com/mennns-adidas-nmd-runner-bl%C3%A5-obuvk">mennns adidas nmd runner bl氓</a> <a href="http://www.bamadu.com/nike-flyknit-racer-grigio-volt-nero-scarpei">nike flyknit racer grigio volt nero</a> <a href="http://www.gamekeyssale.com/adidas-damian-lillard-2-blanco-zapatosh">adidas damian lillard 2 blanco</a> <a href="http://www.aktuelresim.com/nike-air-max-flyknit-sort-skok">nike air max flyknit sort</a> <a href="http://www.myshoesonsale.com/menn-nike-zoom-pegasus-32-dark-bl%C3%A5-r%C3%B8d-obuvi">menn nike zoom pegasus 32 dark bl氓 r酶d</a>
dakvideo http://www.dakvideo.com/
almarsecurity
 almarsecurity 2019-03-16 17:23回复
#131
<a href="http://www.findatrans.com/orlando-magic-new-era-2018-nba-on-court-collection-9fifty-snapback-cap-hatl">orlando magic new era 2018 nba on court collection 9fifty snapback cap</a> <a href="http://www.isabellerigal.com/hommes-nike-shox-current-vert-rouge-chaussuresh">hommes nike shox current vert rouge</a> <a href="http://www.esnafkocaeli.com/nike-air-max-tailwind-7-mujeres-rosado-p%C3%BArpura-zapatosk">nike air max tailwind 7 mujeres rosado p煤rpura</a> <a href="http://www.dkdjabar.com/adidas-neo-ventilation-silver-pink-shoesi">adidas neo ventilation silver pink</a> <a href="http://www.jamiecirillo.com/nike-zoom-kobe-vi-schwarz-gold-schuhei">nike zoom kobe vi schwarz gold</a> <a href="http://www.xpostshopx.com/hombres-nike-cortez-negro-p%C3%BArpura-zapatosp">hombres nike cortez negro p煤rpura</a>
almarsecurity http://www.almarsecurity.com/
handydgh
 handydgh 2019-03-16 09:01回复
#130
<a href="http://www.priakurus.com/zack-greinke-dbacks-jersey-nfli">zack greinke dbacks jersey</a> <a href="http://www.batatastudio.com/air-jordan-13-blanco-and-oro-zapatosh">air jordan 13 blanco and oro</a> <a href="http://www.kahawellness.com/nike-kobe-9-negro-and-blanco-zapatosk">nike kobe 9 negro and blanco</a> <a href="http://www.metabolifes.com/north-face-m-venture-jacket-northfaceh">north face m venture jacket</a> <a href="http://www.breconpharm.com/nike-mercurial-vapor-rot-and-blau-schuhek">nike mercurial vapor rot and blau</a> <a href="http://www.bagintaiwan.com/air-jordan-1-r%C3%B8d-hvid-and-sort-skoi">air jordan 1 r酶d hvid and sort</a>
handydgh http://www.handydgh.com/
onlymytouch
 onlymytouch 2019-03-14 10:51回复
#129
<a href="http://www.rawhouseibiza.com/giannis-antetokounmpo-jersey-t-shirt-nflz">giannis antetokounmpo jersey t shirt</a> <a href="http://www.startnimble.com/air-jordan-1-high-noir-rouge-obuvd">air jordan 1 high noir rouge</a> <a href="http://www.tlgwebsterny.com/hommes-supra-tk-society-violet-argent-scarpec">hommes supra tk society violet argent</a> <a href="http://www.vendsweeps.com/hombres-nike-air-max-thea-p%C3%BArpura-blanco-kurpesb">hombres nike air max thea p煤rpura blanco</a> <a href="http://www.zealouslyzika.com/nfl-nike-pittsburgh-steelers-25-artie-burns-ash-one-color-pullover-hoodie-nflr">nfl nike pittsburgh steelers 25 artie burns ash one color pullover hoodie</a> <a href="http://www.zlotyul.com/nike-free-tr-5.0-v4-pure-platinum-svart-butyg">nike free tr 5.0 v4 pure platinum svart</a>
onlymytouch http://www.onlymytouch.com/
顶部留言底部
 00:00/00:00
我想和你虚度时光 - 花房姑娘(9)
  1. 我想和你虚度时光
  2. 花房姑娘
  3. 恋恋风尘
  4. 我喜爱一切不彻底的事物
  5. 我的心里是满的
  6. Long Way
  7. 给少年的歌
  8. 晴日共剪窗
  9. 天上的月你的脸