https://zy.xzku.cn/ https://zy.xzku.cn/
首页
  • 首页
  • 软件工具
  • 壁纸图库
  • 游戏相关
  • 电视盒子
  • 值得一看
  • 资源杂烩
搜索历史 清空
写文章

登录

账号密码登录
扫码登录
扫码登录
请使用手机扫码登录
注册登录即表示同意用户协议和隐私政策
软件工具
实用工具 音乐软件 追剧软件 小说动漫 电脑软件 图像影音 上传下载
壁纸图库
值得一看
网盘剧集 网盘电影
站长资源
资源杂烩
活动线报
娱乐吃瓜
游戏相关
电视盒子
推荐 最新
获取Emlog输出加载所需时间和数据库查询次数
夕子库xzku 2024-11-25

获取Emlog输出加载所需时间和数据库查询次数

EMLOG内置了一个名为getQueryCount()的函数,我们可以通过调用它来轻松获取加载时间和数据库查询次数的信息。这对于我们深入理解网站的加载速度和优化博客内容非常有帮助。 要使用这个功能,请按如下步骤操作: 打开模板中的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文件顶部: <?php runStartTime(); ?> 随后,在模板的footer.php文件的底部添加以下输出代码: <?php setAndShowFoot(); ?> 操作完成后,请确保进行备份。 教程至此结束。如果网站出现错误,请检查代码放置位置并进行调试。若无法解决,建议恢复至源文件。

332 27 0
Emlog教程Emlog
获取Emlog输出加载所需时间和数据库查询次数
Emlog通过非插件方式实现3D标签云功能
夕子库xzku 2024-11-24

Emlog通过非插件方式实现3D标签云功能

第一步 module找到你的侧边栏标签 修改侧边栏标签如下 <?php //3D标签云 function widget_tag($title){ global $CACHE; $tag_cache = $CACHE->readCache('tags');?> <div class="side"> <h3><i class="fa fa-tags mar-r-4"></i><?php echo $title;?></h3> <div id="tag_cloud_widget"> <div class="tagcloud"> <script type="text/javascript" src="<?php echo TEMPLATE_URL; ?>js/3dtag.js"></script> <?php foreach($tag_cache as $value): ?> <a href="<?php echo Url::tag($value['tagurl']); ?>" title="<?php echo $value['usenum']; ?> 篇文章"><?php echo $value['tagname']; ?></a> <?php endforeach; ?> <div class="clear"></div></div></div></div> <?php }?> 第二步 你的公用模板css放如下css /*3D标签云*/ #tag_cloud_widget{position:relative;width:240px;height:240px;margin:10px auto 10px} #tag_cloud_widget a{position:absolute;color:#fff;text-align:center;text-overflow:ellipsis;white-space:nowrap;top:0;left:0;padding:3px 5px;border:0} #tag_cloud_widget a:hover{background:#d02f53;display:block} #tag_cloud_widget a:nth-child(n){background:#666;border-radius:3px;display:inline-block;line-height:18px;margin:0 10px 15px 0} #tag_cloud_widget a:nth-child(2n){background:#d1a601} #tag_cloud_widget a:nth-child(3n){background:#286c4a} #tag_cloud_widget a:nth-child(5n){background:#518ab2} #tag_cloud_widget a:nth-child(4n){background:#c91d13} 第三步 保存下面js为3dtag.js 放到你的模板js目录里面 var radius = 100; var d = 200; var dtr = Math.PI / 180; var mcList = []; var lasta = 1; var lastb = 1; var distr = true; var tspeed = 11; var size = 200; var mouseX = 0; var mouseY = 10; var howElliptical = 1; var aA = null; var oDiv = null; window.onload = function() { var i = 0; var oTag = null; oDiv = document.getElementById('tag_cloud_widget'); aA = oDiv.getElementsByTagName('a'); for (i = 0; i < aA.length; i++) { oTag = {}; aA[i].onmouseover = (function(obj) { return function() { obj.on = true; this.style.zIndex = 9999; this.style.color = '#fff'; this.style.background = '#0099ff'; this.style.padding = '5px 5px'; this.style.filter = "alpha(opacity=100)"; this.style.opacity = 1 } })(oTag) aA[i].onmouseout = (function(obj) { return function() { obj.on = false; this.style.zIndex = obj.zIndex; this.style.color = '#fff'; this.style.background = '#30899B'; this.style.padding = '5px'; this.style.filter = "alpha(opacity=" + 100 * obj.alpha + ")"; this.style.opacity = obj.alpha; this.style.zIndex = obj.zIndex } })(oTag) oTag.offsetWidth = aA[i].offsetWidth; oTag.offsetHeight = aA[i].offsetHeight; mcList.push(oTag) } sineCosine(0, 0, 0); positionAll(); (function() { update(); setTimeout(arguments.callee, 40) })() }; function update() { var a, b, c = 0; a = (Math.min(Math.max( - mouseY, -size), size) / radius) * tspeed; b = ( - Math.min(Math.max( - mouseX, -size), size) / radius) * tspeed; lasta = a; lastb = b; if (Math.abs(a) <= 0.01 && Math.abs(b) <= 0.01) { return } sineCosine(a, b, c); for (var i = 0; i < mcList.length; i++) { if (mcList[i].on) { continue } var rx1 = mcList[i].cx; var ry1 = mcList[i].cy * ca + mcList[i].cz * ( - sa); var rz1 = mcList[i].cy * sa + mcList[i].cz * ca; var rx2 = rx1 * cb + rz1 * sb; var ry2 = ry1; var rz2 = rx1 * ( - sb) + rz1 * cb; var rx3 = rx2 * cc + ry2 * ( - sc); var ry3 = rx2 * sc + ry2 * cc; var rz3 = rz2; mcList[i].cx = rx3; mcList[i].cy = ry3; mcList[i].cz = rz3; per = d / (d + rz3); mcList[i].x = (howElliptical * rx3 * per) - (howElliptical * 2); mcList[i].y = ry3 * per; mcList[i].scale = per; var alpha = per; alpha = (alpha - 0.6) * (10 / 6); mcList[i].alpha = alpha * alpha * alpha - 0.2; mcList[i].zIndex = Math.ceil(100 - Math.floor(mcList[i].cz)) } doPosition() } function depthSort() { var i = 0; var aTmp = []; for (i = 0; i < aA.length; i++) { aTmp.push(aA[i]) } aTmp.sort(function(vItem1, vItem2) { if (vItem1.cz > vItem2.cz) { return - 1 } else if (vItem1.cz < vItem2.cz) { return 1 } else { return 0 } }); for (i = 0; i < aTmp.length; i++) { aTmp[i].style.zIndex = i } } function positionAll() { var phi = 0; var theta = 0; var max = mcList.length; for (var i = 0; i < max; i++) { if (distr) { phi = Math.acos( - 1 + (2 * (i + 1) - 1) / max); theta = Math.sqrt(max * Math.PI) * phi } else { phi = Math.random() * (Math.PI); theta = Math.random() * (2 * Math.PI) } mcList[i].cx = radius * Math.cos(theta) * Math.sin(phi); mcList[i].cy = radius * Math.sin(theta) * Math.sin(phi); mcList[i].cz = radius * Math.cos(phi); aA[i].style.left = mcList[i].cx + oDiv.offsetWidth / 2 - mcList[i].offsetWidth / 2 + 'px'; aA[i].style.top = mcList[i].cy + oDiv.offsetHeight / 2 - mcList[i].offsetHeight / 2 + 'px' } } function doPosition() { var l = oDiv.offsetWidth / 2; var t = oDiv.offsetHeight / 2; for (var i = 0; i < mcList.length; i++) { if (mcList[i].on) { continue } var aAs = aA[i].style; if (mcList[i].alpha > 0.1) { if (aAs.display != '') aAs.display = '' } else { if (aAs.display != 'none') aAs.display = 'none'; continue } aAs.left = mcList[i].cx + l - mcList[i].offsetWidth / 2 + 'px'; aAs.top = mcList[i].cy + t - mcList[i].offsetHeight / 2 + 'px'; aAs.filter = "alpha(opacity=" + 100 * mcList[i].alpha + ")"; aAs.zIndex = mcList[i].zIndex; aAs.opacity = mcList[i].alpha } } function sineCosine(a, b, c) { sa = Math.sin(a * dtr); ca = Math.cos(a * dtr); sb = Math.sin(b * dtr); cb = Math.cos(b * dtr); sc = Math.sin(c * dtr); cc = Math.cos(c * dtr) }

317 27 0
Emlog教程Emlog
Emlog通过非插件方式实现3D标签云功能
仿刀网Emlog下载样式代码
夕子库xzku 2024-11-24

仿刀网Emlog下载样式代码

Emlog的刀网下载样式设计简洁清新,可以根据自己的需求进行个性化修改。在保持简约风格的同时,遵循简洁原则,力求达到最佳效果。 在文章中插入如下Html代码 <div class="Emdown"> <div class="Emdown-body"> <div class="Emdown-title-left">下载地址</div> <div class="Emdown-title-right">●温馨提示●</div> </div> <div class="Emdown-box"> <a href="#" target="_blank" rel="nofollow"><i class="fa fa-cloud-download"></i>本地下载</a> <a href="#" target="_blank" rel="nofollow"><i class="fa fa-cloud-download"></i>网盘下载</a> </div> <div class="Emdown-txt">免责声明:本站资源转载自各大论坛及资源下载站,若有侵权请速联系站长,我们将会在24小时内删除,谢谢!</div> </div> 在公用css代码库插入如下css代码 .Emdown{overflow:hidden;margin-top:30px;width:100%;border:1px dashed silver;border-radius:2px;background-color:#f9f9f9;} .Emdown .Emdown-body{overflow:hidden;margin-bottom:10px;} .Emdown .Emdown-box{overflow:hidden;padding:15px;border-top:1px solid #f1f1f1;} .Emdown .Emdown-txt{padding:10px 15px;border-top:1px solid #f1f1f1;color:#afafaf;font-size:14px;} .Emdown .Emdown-body .Emdown-title-left{float:left;margin-left:15px;width:81pt;height:35px;border-radius:0 0 2px 2px;background-color:#2585c3;color:#fff;text-align:center;font-size:1pc;line-height:35px;} .Emdown .Emdown-body .Emdown-title-right{float:right;margin-right:15px;color:#afafaf;font-size:14px;line-height:35px;} .Emdown .Emdown-box a{float:left;margin-right:15px;padding:15px;border:1px solid #ddd;border-radius:2px;color:#2585c3;text-align:center;} .Emdown .Emdown-box a:hover{border:1px solid #2585c3;background-color:#2585c3;color:#fff;} .Emdown .Emdown-box a i{margin-right:5px;}

357 27 0
Emlog教程Emlog
仿刀网Emlog下载样式代码
emlog 无插件实现网站源码压缩
夕子库xzku 2024-11-21

emlog 无插件实现网站源码压缩

在以往的 emlog 优化教程中,相信都是使用的代码压缩插件,今天主要是分享插件的代码版本,也就是不使用插件,直接将代码写在 module.php 中就可以,好吧,又消灭一个插件! 以下代码是写在 module.php 里面 <?php function em_compress_html($buffer) { $initial = strlen($buffer); $buffer = explode("<!--em-compress-html-->", $buffer); $count = count($buffer); for ($i = 0; $i <= $count; $i++) { if (stristr($buffer[$i], '<!--em-compress-html no compression-->')) { $buffer[$i] = (str_replace("<!--em-compress-html no compression-->", " ", $buffer[$i])); } else { $buffer[$i] = (str_replace("\t", " ", $buffer[$i])); $buffer[$i] = (str_replace("\n\n", "\n", $buffer[$i])); $buffer[$i] = (str_replace("\n", "", $buffer[$i])); $buffer[$i] = (str_replace("\r", "", $buffer[$i])); while (stristr($buffer[$i], ' ')) { $buffer[$i] = (str_replace(" ", " ", $buffer[$i])); } } $buffer_out .= $buffer[$i]; } $final = strlen($buffer_out); $savings = ($initial - $final) / $initial * 100; $savings = round($savings, 2); $buffer_out .= PHP_EOL . "<!--压缩前的大小: $initial bytes; 压缩后的大小: $final bytes; 节约:$savings% -->"; return $buffer_out; } ?> 以下代码放在 footer.php 最末尾(即结尾处) <?php if (_g('compress_html') == 'open') { $html = ob_get_contents(); ob_get_clean(); echo em_compress_html($html); } ?> 以上的代码有一个模板设置判断语句,其代码为以下(放在 options.php 里面) 'compress_html' => array( 'type' => 'radio', 'name' => '网站源码压缩', 'description' => '将HTML的空格和空行删除,保留pre里面的格式,压缩输出的HTML~', 'values' => array('open' => '开启', 'close' => '关闭'), 'default' => 'open' ), 如果你想要实现不压缩 pre(就是网页中插入的代码,这样就能显示代码的排版)中的代码,要在 module.php 里面的加入下面代码。 <?php function unCompress($content) { if (preg_match_all('/(<pre|<\/pre>)/i', $content, $matches)) { $content = '<!--em-compress-html--><!--em-compress-html no compression-->' . $content; $content .= '<!--em-compress-html no compression--><!--em-compress-html-->'; } return $content; } ?> 然后找到模版文件夹下的 echo_log.php(文章内容页面)、page.php(评论页面)文件中的 $log_content 替换掉。 <?php echo $log_content; ?> // 替换为 <?php echo unCompress($log_content); ?> 不压缩 pre 的解决方法二,直接把第一步的 module.php 里面的 em_compress_html 修改一下 <?php function em_compress_html($buffer) { $initial = strlen($buffer); $buffer = preg_replace('/<pre/', '<!--em-compress-html--><!--em-compress-html no compression--><pre', $buffer); $buffer = preg_replace('/<\/pre/', '<!--em-compress-html no compression--><!--em-compress-html--></pre', $buffer); $buffer = explode("<!--em-compress-html-->", $buffer); $count = count($buffer); for ($i = 0; $i <= $count; $i++) { if (stristr($buffer[$i], '<!--em-compress-html no compression-->')) { $buffer[$i] = (str_replace("<!--em-compress-html no compression-->", " ", $buffer[$i])); } else { $buffer[$i] = (str_replace("\t", " ", $buffer[$i])); $buffer[$i] = (str_replace("\n\n", "\n", $buffer[$i])); $buffer[$i] = (str_replace("\n", "", $buffer[$i])); $buffer[$i] = (str_replace("\r", "", $buffer[$i])); while (stristr($buffer[$i], ' ')) { $buffer[$i] = (str_replace(" ", " ", $buffer[$i])); } } $buffer_out .= $buffer[$i]; } $final = strlen($buffer_out); $savings = ($initial - $final) / $initial * 100; $savings = round($savings, 2); $buffer_out .= PHP_EOL . "<!--压缩前的大小: $initial bytes; 压缩后的大小: $final bytes; 节约:$savings% -->"; return $buffer_out; } ?>

397 27 0
Emlog教程代码压缩

热门文章

  • 1 气质贤妻 办公室黑丝端木蓉 国漫女神 ​​​
  • 2 [夸克下载][埃利亚斯][WEB-MKV/2.37G][法语中字][1080P][2024最新刺激动作枪战]
  • 3 PC迅雷游戏加速器免费获取口令兑换会员,白嫖会员权益!
  • 4 迅猛兔加速器解锁版 3.2.31国内外手游加速器
  • 5 全集 [夸克下载][10月16日精品付费短剧合集][共27部][WEB-MKV/9.9G][国语中字][1080P]

标签

  • 碧瑶
  • 동그란
  • 手机软件
  • 免费虚拟主机
  • 照片编辑
  • 图片处理
  • 安卓虚拟机
  • 虚拟大师
  • 虚拟系统
  • 激活工具
  • 装B神器
  • 陆雪琪
  • 云曦
  • 宁姚
  • 清漪
  • 金瓶儿
  • 圣采儿
  • 天穹
  • macOS
  • 美人鱼
  • 美杜莎
  • 唐火儿
  • 夏倾月
  • 虚天神藤
  • 元瑶
  • 玄衣
  • 应用分身
  • 虚拟定位
  • 火灵儿
  • 文件管理
  • 抖音助手
  • 网站推荐
  • 休闲娱乐
  • 马来西亚
  • Wordpress
  • Emlog
  • VPN
  • 主题壁纸
  • 代码压缩
  • Emlog教程
  • 爱情
  • 怀旧服
  • 穿越火线
  • 系列
  • 全集
  • 开源版
  • 剧情
  • 欧美
  • 2023
  • 黑科技工具

最新文章

  • 1 音乐搜索v2.0.0版提供付费音乐的免费下载服务
  • 2 搜狗输入法V12.10最新会员内购版
  • 3 甜蜜话语聊天库1.0去更新广告纯净版
  • 4 余额装测试版1.0自定义设置 WX 支付宝余额
  • 5 无影云电脑7.5.1专属个人云电脑 白嫖30天云电脑

微语

  • 夕子库xzku
    2024-11-29 13:21

  • 夕子库xzku
    2024-11-15 19:03

    q

关于 友链 rss
赣ICP备2024048016号

备案号: