2.9978s ( Load:0.0130s Init:0.0047s Exec:2.9360s Template:0.0441s )
吞吐率 : 0.33req/s
求解决方案
Exec是什么意思
<code><include file="./Application/Home/View/Common/head.html" title="书签分类" /> <include file="./Application/Home/View/Common/navbar.html" /> <style> .url-box{ border: solid #AADDBB 1px; text-align: center; line-height: 14px; font-size: 14px; background-color: #fcfcfc; margin:10px ; padding: 10px ; } .url-text{ color:black; line-height: 20px; font-size: 14px; } .url-text:hover{ color:#FF5500; } a:hover{ text-decoration: none; } </style> <div class="sui-row-fluid"> <div class="span1 column ui-sortable"> <ul class="sui-nav nav-list"> <li class="displayBookmark"><a href="__MODULE__/Bookmark/displayBookmark">书签管理</a></li> <li class="displayBookmarkcategory"><a href="__MODULE__/Bookmarkcategory/displayBookmarkcategory">书签分类</a></li> </ul> </div> {/*span1 end*/} <div class="span1 column ui-sortable"> <ul class="sui-nav nav-tabs nav-xlarge tab-navbar tab-vertical tab-light"> <li <empty name="Think.get.cid">class="active" </empty>> <a href="__MODULE__/Bookmark/displayBookmark">全部分类</a> </li> <volist name="parentcategory" id="p"> <li <if condition="$_GET['cid'] eq $p['bookmarkcategory_id']">class='active'</if> > <a href="__MODULE__/Bookmark/displayBookmark/cid/{$p.bookmarkcategory_id}"> {$p.bookmarkcategory_name} </a> </li> </volist> </ul> </div> {/*span1 end*/} <div class="span10 column ui-sortable"> <a id="create" href="javascript:void(0);" class="sui-btn btn-large btn-primary" >新增书签</a> <div class="" id="refresh"> <volist name="secondClass" id="sc"> <span style="margin-left: 50%" >{$sc.bookmarkcategory_name} <span id="openurl_{$sc.bookmarkcategory_id}"> <button class="sui-btn btn-bordered btn-primary">全开</button> </span> </span> <div class="url-box" > <div class="sui-row-fluid" id="item_{$sc.bookmarkcategory_id}" > <volist name="bookmarkresult" id="vo"> <if condition="$sc['bookmarkcategory_id'] eq $vo['bookmark_cid']"> <div class="span1" id="url_{$vo.bookmark_id}"> <a id="{$vo.bookmark_id}" href="http://{$vo.bookmark_url}" class="url-text" target="_blank"> {$vo.bookmark_name} </a> <span id="displayurl_{$vo.bookmark_id}" style="display: none"> <br> <a href="__MODULE__/Bookmark/deleteBookmark/id/{$vo.bookmark_id}" onclick="if (!confirm('确认要删除?')) {window.event.returnValue = false;}"> <i class="iconfont" style="font-size: 10%"></i> </a> <a href="javascript:void();" id="{$vo.bookmark_id}_update"> <i class="iconfont" style="font-size: 10%"></i> </a> </span> </div> </if> </volist> </div> </div> </volist> </div> </div> {/*span10 end*/} </div>{/*sui-row-fluid end*/} </body> <script> $(document).ready(function(){ $("#create").click(function(){ layer.open({ type: 2, {/*0(信息框,默认)1(页面层)2(iframe层)3(加载层)4(tips层)*/} title: '新增书签', shadeClose: true,{/*是否点击遮罩关闭*/} shade: [0.3], area: ['700px', '750px'], content: "__MODULE__/Bookmark/createBookmark", closeBtn:1, {/*0代表无关闭按钮 1很小的关闭按钮 2是圆角关闭按钮 */} shift:0,{/*动画 0无 1-6*/} maxmin: true,{/*显示最大小化按钮*/} //skin: 'layui-layer-rim', //加上边框 cancel: function () { location.reload(); }, end: function(){ location.reload(); }, }); }); function re(){ {/*批量弹出url start*/} <volist name="secondClass" id="sc"> $('#openurl_{$sc.bookmarkcategory_id}').click(function(){ var id ="{$sc.bookmarkcategory_id}"; <volist name="bookmarkresult" id="vo"> if(id == "{$vo.bookmark_cid}") { window.open('http://{$vo.bookmark_url}'); } </volist> }); </volist> {/*批量弹出url end*/} {/*鼠标指在上面就显示控制start*/} <volist name="bookmarkresult" id="vo"> $("#url_{$vo.bookmark_id}").mouseover(function(){ $("#displayurl_{$vo.bookmark_id}").show(); }); $("#url_{$vo.bookmark_id}").mouseout(function(){ $("#displayurl_{$vo.bookmark_id}").hide(); }); </volist> {/*鼠标指在上面就显示控制end */} {/*拖拽排序start*/} <volist name="secondClass" id="sc"> var el = document.getElementById('item_{$sc.bookmarkcategory_id}'); var sortable = new Sortable(el, { group: "{$sc.bookmarkcategory_id}", animation: 150, onUpdate: function (evt/**Event*/){ //得到拖动元素的id var item = evt.item; var iddd=item.innerHTML; //起点元素id var startid=$(iddd).prop("id"); // alert(startid); //获取是否移到了第一个 var isone=evt.newIndex; //获取终点元素id if(evt.newIndex==0){ //当拖拽到第一个的时候执行 var id2 = evt.target.children[evt.newIndex+1]; var id3 = id2.innerHTML; var endid = $(id3).prop("id"); }else{ var id2 = evt.target.children[evt.newIndex - 1]; var id3 = id2.innerHTML; var endid = $(id3).prop("id"); } $.get("__MODULE__/Bookmark/ajaxUpdateBookmarkSort/startid/"+startid+"/endid/"+endid+"/isone/"+isone,function(data,status){ if(data==1){ //ajax成功 }else{ //ajax失败 } }); } ,// dragging ended }); </volist> {/*拖拽排序end*/} <volist name="bookmarkresult" id="vo"> $("#{$vo.bookmark_id}_update").click(function(){ layer.open({ type: 2, {/*0(信息框,默认)1(页面层)2(iframe层)3(加载层)4(tips层)*/} title :'修改书签', shadeClose: true,{/*是否点击遮罩关闭*/} shade: [0.3], area: ['700px', '750px'], content: '__MODULE__/Bookmark/updateBookmark/id/{$vo.bookmark_id}', closeBtn:1, {/*0代表无关闭按钮 1很小的关闭按钮 2是圆角关闭按钮 */} shift:0,{/*动画 0无 1-6*/} maxmin: true,{/*显示最大小化按钮*/} //skin: 'layui-layer-rim', //加上边框 cancel: function () { $("#refresh").load(location.href+" #refresh>*",function(){ re(); }); }, end: function(){ $("#refresh").load(location.href+" #refresh>*",function(){ re(); }); }, }); }); </volist> } re(); {/*jquery end*/} }); </script> </html></code>
2.9978s ( Load:0.0130s Init:0.0047s Exec:2.9360s Template:0.0441s )
吞吐率 : 0.33req/s
求解决方案
Exec是什么意思
<code><include file="./Application/Home/View/Common/head.html" title="书签分类" /> <include file="./Application/Home/View/Common/navbar.html" /> <style> .url-box{ border: solid #AADDBB 1px; text-align: center; line-height: 14px; font-size: 14px; background-color: #fcfcfc; margin:10px ; padding: 10px ; } .url-text{ color:black; line-height: 20px; font-size: 14px; } .url-text:hover{ color:#FF5500; } a:hover{ text-decoration: none; } </style> <div class="sui-row-fluid"> <div class="span1 column ui-sortable"> <ul class="sui-nav nav-list"> <li class="displayBookmark"><a href="__MODULE__/Bookmark/displayBookmark">书签管理</a></li> <li class="displayBookmarkcategory"><a href="__MODULE__/Bookmarkcategory/displayBookmarkcategory">书签分类</a></li> </ul> </div> {/*span1 end*/} <div class="span1 column ui-sortable"> <ul class="sui-nav nav-tabs nav-xlarge tab-navbar tab-vertical tab-light"> <li <empty name="Think.get.cid">class="active" </empty>> <a href="__MODULE__/Bookmark/displayBookmark">全部分类</a> </li> <volist name="parentcategory" id="p"> <li <if condition="$_GET['cid'] eq $p['bookmarkcategory_id']">class='active'</if> > <a href="__MODULE__/Bookmark/displayBookmark/cid/{$p.bookmarkcategory_id}"> {$p.bookmarkcategory_name} </a> </li> </volist> </ul> </div> {/*span1 end*/} <div class="span10 column ui-sortable"> <a id="create" href="javascript:void(0);" class="sui-btn btn-large btn-primary" >新增书签</a> <div class="" id="refresh"> <volist name="secondClass" id="sc"> <span style="margin-left: 50%" >{$sc.bookmarkcategory_name} <span id="openurl_{$sc.bookmarkcategory_id}"> <button class="sui-btn btn-bordered btn-primary">全开</button> </span> </span> <div class="url-box" > <div class="sui-row-fluid" id="item_{$sc.bookmarkcategory_id}" > <volist name="bookmarkresult" id="vo"> <if condition="$sc['bookmarkcategory_id'] eq $vo['bookmark_cid']"> <div class="span1" id="url_{$vo.bookmark_id}"> <a id="{$vo.bookmark_id}" href="http://{$vo.bookmark_url}" class="url-text" target="_blank"> {$vo.bookmark_name} </a> <span id="displayurl_{$vo.bookmark_id}" style="display: none"> <br> <a href="__MODULE__/Bookmark/deleteBookmark/id/{$vo.bookmark_id}" onclick="if (!confirm('确认要删除?')) {window.event.returnValue = false;}"> <i class="iconfont" style="font-size: 10%"></i> </a> <a href="javascript:void();" id="{$vo.bookmark_id}_update"> <i class="iconfont" style="font-size: 10%"></i> </a> </span> </div> </if> </volist> </div> </div> </volist> </div> </div> {/*span10 end*/} </div>{/*sui-row-fluid end*/} </body> <script> $(document).ready(function(){ $("#create").click(function(){ layer.open({ type: 2, {/*0(信息框,默认)1(页面层)2(iframe层)3(加载层)4(tips层)*/} title: '新增书签', shadeClose: true,{/*是否点击遮罩关闭*/} shade: [0.3], area: ['700px', '750px'], content: "__MODULE__/Bookmark/createBookmark", closeBtn:1, {/*0代表无关闭按钮 1很小的关闭按钮 2是圆角关闭按钮 */} shift:0,{/*动画 0无 1-6*/} maxmin: true,{/*显示最大小化按钮*/} //skin: 'layui-layer-rim', //加上边框 cancel: function () { location.reload(); }, end: function(){ location.reload(); }, }); }); function re(){ {/*批量弹出url start*/} <volist name="secondClass" id="sc"> $('#openurl_{$sc.bookmarkcategory_id}').click(function(){ var id ="{$sc.bookmarkcategory_id}"; <volist name="bookmarkresult" id="vo"> if(id == "{$vo.bookmark_cid}") { window.open('http://{$vo.bookmark_url}'); } </volist> }); </volist> {/*批量弹出url end*/} {/*鼠标指在上面就显示控制start*/} <volist name="bookmarkresult" id="vo"> $("#url_{$vo.bookmark_id}").mouseover(function(){ $("#displayurl_{$vo.bookmark_id}").show(); }); $("#url_{$vo.bookmark_id}").mouseout(function(){ $("#displayurl_{$vo.bookmark_id}").hide(); }); </volist> {/*鼠标指在上面就显示控制end */} {/*拖拽排序start*/} <volist name="secondClass" id="sc"> var el = document.getElementById('item_{$sc.bookmarkcategory_id}'); var sortable = new Sortable(el, { group: "{$sc.bookmarkcategory_id}", animation: 150, onUpdate: function (evt/**Event*/){ //得到拖动元素的id var item = evt.item; var iddd=item.innerHTML; //起点元素id var startid=$(iddd).prop("id"); // alert(startid); //获取是否移到了第一个 var isone=evt.newIndex; //获取终点元素id if(evt.newIndex==0){ //当拖拽到第一个的时候执行 var id2 = evt.target.children[evt.newIndex+1]; var id3 = id2.innerHTML; var endid = $(id3).prop("id"); }else{ var id2 = evt.target.children[evt.newIndex - 1]; var id3 = id2.innerHTML; var endid = $(id3).prop("id"); } $.get("__MODULE__/Bookmark/ajaxUpdateBookmarkSort/startid/"+startid+"/endid/"+endid+"/isone/"+isone,function(data,status){ if(data==1){ //ajax成功 }else{ //ajax失败 } }); } ,// dragging ended }); </volist> {/*拖拽排序end*/} <volist name="bookmarkresult" id="vo"> $("#{$vo.bookmark_id}_update").click(function(){ layer.open({ type: 2, {/*0(信息框,默认)1(页面层)2(iframe层)3(加载层)4(tips层)*/} title :'修改书签', shadeClose: true,{/*是否点击遮罩关闭*/} shade: [0.3], area: ['700px', '750px'], content: '__MODULE__/Bookmark/updateBookmark/id/{$vo.bookmark_id}', closeBtn:1, {/*0代表无关闭按钮 1很小的关闭按钮 2是圆角关闭按钮 */} shift:0,{/*动画 0无 1-6*/} maxmin: true,{/*显示最大小化按钮*/} //skin: 'layui-layer-rim', //加上边框 cancel: function () { $("#refresh").load(location.href+" #refresh>*",function(){ re(); }); }, end: function(){ $("#refresh").load(location.href+" #refresh>*",function(){ re(); }); }, }); }); </volist> } re(); {/*jquery end*/} }); </script> </html></code>
Exec 是程序执行时间,Load:0.0130s Init:0.0047s Exec:2.9360s Template:0.0441s
你这里 初始化使用了 0.0047秒 执行程序用了 2.9360秒 模板渲染用了 0.0441秒
然后你贴出模板的代码,并不能起到什么左右。
这js写的也太戳了。。而且竟然循环绑定事件。。
Exec:2.9360s 最长时间消耗在这里。
PHP代码执行效率低,要么就是和数据库交互的时候,查库慢,要么就是PHP代码问题
tp本身肯定没问题,能出现的原因如下:
请把数据库配置文件的的localhost
改为127.0.0.1
,不止tp
有这个问题,好多程序都有这个问题,我猜测可能和本地的电脑配置有关,但是改成127.0.0.1
就没问题了。
项目原因本身原因。
如果每个页面都是执行很长时间,基本上就属于问题1了。如果是单个页面执行慢,那么就检查单个页面。
我猜测是问题1的可能性最大。
开启服务器日志,排查
应该是你内部php逻辑代码产生的问题!执行时间太长了