菲莱神庙 (aka Temple of Isis), 阿斯旺, 埃及 (© Ratnakorn Piyasirisorost/Getty Images)

Welcom to 评论 - lizhenqiu blog!

    #951

    作者:广西南宁市
    如果是你php内容不在同一个文件,肯定首先都是要先引入的,要先引入肯定要先知道文件路径这是必不可少的,如果你已经知道文件内容了,而不想引入方式来解决,直接写到一个文件里面不就可以了么?
    eval函数可以直接把字符串作为php代码执行,如 eval('$A=1;'); echo $A;输出1;
    但是不建议这样用,比较你的需求是已经知道代码内容了,只是不想引入,不想引入写到一个文件就行了,你说文件太多,写到一个里面太乱,太长,那肯定是鱼和熊掌不能兼得的事情。
    另外也可以试试文件导入缓存机制,第一次引入文件需要读取io重复读取不用读取io
    function includes($file){ $static $cache = []; if(isset($cache[$file])){ return $cache[$file]; }else{ return $cache[$file] = include $file; } }
    Run code
    Cut to clipboard
      文章:ThinkPHP中实现微信支付(jsapi支付)流程  发表时间:2017-09-19, 11:54:40  
      展开↯

      #952

      作者:广西南宁市
      div设置overflow-y:scroll时怎么阻止body页面的滚动?
      js body滚动冒泡
      js滚动冒泡
      对局部需要滚动条的元素,尝试使用这个css属性: -webkit-overflow-scrolling: touch;
      Run code
      Cut to clipboard

        两种方法,1.设置body:fixed.2.设置body height:100%,设置body的子元素div高度100%,overflow:hidden
        Run code
        Cut to clipboard
          文章:常用html、demo代码  发表时间:2017-09-19, 11:51:43  
          展开↯

          #953

          作者:广西南宁市
          javascript中的this和e.target的深入研究
          this 是javascript的一个关键字,当函数运行时在内部自动生成。this是会变化的,在不同的场合,代表的东西就不一样。简单点来说,this指调用这个函数的对象。当你使用this代表的当前html元素,这样你就可以使用这个元素的属性和方法呢。
          e.target 中的e是可以自己随意取名的,现在关键讲的是target。简单点说就是触发这个事件的目标元素。它和this的区别就在于this是会变得,而target是不会变得,target的认定了目标就不会发生变化了。this其实就等于e.currentTarget.
          #,广西南宁市,2017-09-19,11:37:04,
          this和event.target的区别:
          js中事件是会冒泡的,所以this是可以变化的,但event.target不会变化,它永远是直接接受事件的目标DOM元素;
          .this和event.target都是dom对象
          #,广西南宁市,2017-09-19,11:37:38,
            $(this)是触发执行当前函数块(事件处理函数)最内层(距离最近的)的jQuery对象,在你的代码中就是触发了mouseover事件的对象。
            function(e)中的参数e是事件对象,根据事件的不同,具有对应的子属性,比如键盘事件和鼠标事件等,你的代码中对应的是鼠标事件。
          #,广西南宁市,2017-09-19,11:40:47, .click(function(event) 中的event ,是什么意思?
          $('#video_popup .close').click(function(event) { event.preventDefault(); $('#video_popup').hide(); });
          Run code
          Cut to clipboard

            请各位大哥详细分析?
            click(function(event) 中的event是事件对象的意思,event这里因为是单击,就是mouseEvent(鼠标事件)。
            event.preventDefault();这是阻止默认事件,比如在浏览器中点击右键,会弹出一个菜单,加了这句之后就不会弹出这个菜单了,还有单击链接,会跳到相应的地址,加了这句就不会跳转了,这句等效于return false。
            #,广西南宁市,2017-09-19,11:42:49,
            input.onclick = function (evt) { //接受 event 对象,名称不一定非要 event alert(evt); //MouseEvent,鼠标事件对象 IE不支持 但是IE中,不支持直接接收,而是通过window.event来接收。 };
            Run code
            Cut to clipboard
              文章:简说javascript的this的指向4个运用场景  发表时间:2017-09-19, 11:36:39  
              展开↯

              #954

              作者:广西南宁市
              三栏布局的实现方式
              <!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8"> <meta name="viewport" content="width=device-width, initial-scale=1.0"> <meta http-equiv="X-UA-Compatible" content="ie=edge"> <title>Three Column Layout</title> <style> .left, .right{ width: 100px; height: 100px; background-color: #B48649; } .main{ height: 100px; background-color: #1D95A5; } .selfFloat .left{ float: left; } .selfFloat .right{ float: right; } .selfFloat .main{ margin: 0 100px; } .absolutePosition { position: relative; } .absolutePosition .left{ position: absolute; top: 0; left: 0; } .absolutePosition .right{ position: absolute; top: 0; right: 0; } .absolutePosition .main{ margin: 0 100px; } .marginColumn .main{ width:100%; float: left; } .marginColumn .main .content{ margin: 0 100px; } .marginColumn .left{ margin-left: -100%; float: left; } .marginColumn .right{ margin-left: -100px; float: left; } .flexContent{ display: flex; } .flexContent .main{ flex:1; } </style> </head> <body> <p>自身浮动</p> <div class="selfFloat"> <div class="left"></div> <div class="right"></div> <div class="main"></div> </div> <p>绝对定位</p> <div class="absolutePosition"> <div class="left"></div> <div class="right"></div> <div class="main"></div> </div> <p>margin负值法</p> <div class="marginColumn"> <div class="main"> <div class="content"></div> </div> <div class="left"></div> <div class="right"></div> </div> <p>flex</p> <div class="flexContent"> <div class="left"></div> <div class="main"></div> <div class="right"></div> </div> </body> </html>
              Run code
              Cut to clipboard
                文章:CSS布局居中方法  发表时间:2017-09-19, 11:35:25  
                展开↯

                #955

                作者:广西南宁市
                文章:Weiphp微官网框架修改使用说明  发表时间:2017-09-19, 11:33:38  
                展开↯

                #956

                作者:广西南宁市
                DOM操作相关 事件和方法
                1. 获取元素方法 1.根据 id var element = document.getElementById("idName"); 2.根据 标签名 var elements = document.getElementsByTagName("标签名"); 3.根据 类名 var elements = document.getElementsByClassName("类名"); 4.H5新增 获取方法 document.queryselector(""); document.queryselectorAll(""); 5.获取 body 元素 document.body 2. 事件 1.点击事件(双击事件ondblclick) ele.onclick = function(){}; 2.鼠标事件 1.鼠标悬浮(经过) ele.onmouseover = function(){}; 2.鼠标离开 ele.onmouseout = function(){}; onmouseenter和onmouseleave是DOM2的方法, 有兼容问题 onmouseover 鼠标经过盒子的时候执行1次 onmousemove 鼠标只要移动的时候就会执行 3.鼠标按下 ele.onmousedown = function(){}; 4.鼠标弹起 ele.onmouseup = function(){}; 5.鼠标滚动 ele.onmousewheel = function(){}; 3.焦点事件 1.失去焦点 ele.onblur = function(){}; 2.获得焦点 ele.onfocus = function(){}; 3.输入事件 ele.oninput = function(){}; onkeyup和oninput 联想搜索 4.内容发生改变 ele.onchange = function(){}; 一般做验证或者下拉框选择会使用onchange 4.键盘事件 1.键盘键入 ele.onkeydown = function(){}; 2.键盘弹起 ele.onkeyup = function(){}; 3.键盘按下 ele.onleypress = function(){}; onkeydown优先于onkeypress执行 onkeypress不识别系统按键 onkeypress区分大小写 5.window 事件 1.键盘事件 event.keyCode 键盘对应的编码 2.页面滚动 window.onscroll = function(){}; window.scroll必须有滚动条才触发, 一般配合$(window).scrollTop() window.onmousewheel / document.onmousewheel无论有没有滚动条都能触发 3.窗口大小变化 window.onresize = function(){}; 3. 字符串 相关方法 1.replace() 字符串替换 xxx = xxx.replace(searchValue, replaceValue); 只找第一个匹配的替换 2.indexOf() --- lastIndexOf() 搜索(找到 对应的 返回位置) 一个参数从第一个找 两个参数从指定的位置找 不存在返回 -1, 查找的是""返回 0 3.trim() 删除左右空格 4.split("") 字符串 转换成 数组 引号里确定用什么分割 5.charAt() 获取指定位置处字符 6.slice() 从start位置开始,截取到end位置,end取不到 7.substring() 从start位置开始,截取到end位置,end取不到 8.substr() 从start位置开始,截取length个字符 9.toUpperCase() str转换为大写 10.toLowerCase() str转换为小写 4.数组 相关方法 1.join("") 数组 转换成 字符串 引号里确定用什么拼接(默认逗号) 2.toString() 数组 转换为 字符串 (去掉[]) 3.valueOf() 返回数组对象本身 4.Array.isArray(xxx) 检测xxx是否是数组 5.xxx instanceOf Array 检测xxx是否是数组 6.push() pop() 从后边增删 7.unshift() shift() 从前边增删 8.reverse() 翻转数组 9.slice() 从数组中截取一部分内容 10.splice() 从数组中删除或替换数组中的一部分 11. xxx.indexOf() 寻找指定元素在数组中的位置,如果没找到返回-1 12. xxx.lastIndexOf() 从后面找 13.xxx.filter(function(){ }) 迭代过滤/筛选 14.xxx.forEach(function(){ }) 遍历 15.xxx.map(function(){ }) 映射 16.xxx.some(function(){ }) 数组中至少有一个数据符合要求 17.xxx.every(function(){ }) 数组中所有数据符合要求 18.concat() 把一个数组和另一个数组拼接在一起 19.sort() 进行冒泡排序 b-a倒序 a-b升序
                Run code
                Cut to clipboard
                  文章:简说javascript的this的指向4个运用场景  发表时间:2017-09-19, 11:31:24  
                  展开↯

                  #957

                  作者:广西南宁市
                  chrome table + svg,刷新一闪一闪的
                  解决方法,给svg高度和字体大小一致
                  <style> embed{font-size: 25px;height: 25px;} </style>
                  Run code
                  Cut to clipboard
                    #,广西南宁市,2017-09-19,10:21:00,
                    <!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8"> <title>Title</title> </head> <style> table{ height: 50px; background: #000; color: white; font-size: 25px; } </style><style> embed{font-size: 25px;height: 25px;line-height:25px;} </style> <body> <table width="100%"> <tr> <th> <embed src="http://23.105.205.22/search.svg" type="image/svg+xml" /> </th> </tr> </table> </body> </html>
                    Run code
                    Cut to clipboard
                      文章:常用html、demo代码  发表时间:2017-09-19, 10:18:35  
                      展开↯

                      #958

                      作者:广西南宁市
                      不需要图片,纯css创建三角形
                      <html> <head> <title></title> <meta name="" content=""> <style style="text/javascript"> .content{ width:0px; height:0px; border-left:10px solid transparent; border-top:10px solid transparent; border-bottom:10px solid transparent; border-right:10px solid #151313; } </style> </head> <body> <div class="content"> </div> </body> </html>
                      Run code
                      Cut to clipboard

                        其实原理很简单,首先,border边框是以矩形无缝拼接的,
                        <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html> <head> <title></title> <meta name="" content=""> <style style="text/javascript"> .content{ width:10px; height:10px; border-left:50px solid #432a23; border-top:50px solid #38a578; border-bottom:50px solid #38c7c7; border-right:50px solid #151313; } </style> </head> <body> <div class="content"> </div> </body> </html>
                        Run code
                        Cut to clipboard

                          这样,当div的面积越来越小到为零的时候,梯形的上底也接近于零,也就变成了三角形了,这个时候,再用border的transparent属性将不想要的边框设为透明,即可获得你想要的方向的三角形啦!
                          文章:CSS小三角形和阴影效果  发表时间:2017-09-18, 17:28:25  
                          展开↯

                          #959

                          作者:广西南宁市
                          jq版,鼠标拖拽
                          <!DOCTYPE html> <html onselectstart="return false"> <head lang="en" > <meta charset="UTF-8"> <title></title> <style> *{ margin: 0; padding: 0; } li{ list-style: none; } #main{ width: 300px; height: 300px; left: 50%; top: 50%; position: absolute; background: antiquewhite; } #main-top{ width: 300px; height: 50px; background: #c7cecd; cursor: move; } </style> </head> <body> <div id="main"> <div id="main-top">拖拽我</div> <div id="main-bottom"></div> </div> <script src="http://lib.sinaapp.com/js/jquery/1.7.2/jquery.min.js"></script> <script> $(function(){ var main=$("#main"); var box=$('#main-top'); var offx=0; var offy=0; var mainw=main.width(); var mainh=main.height(); //鼠标按下 box.mousedown(function(ev){ var ev=ev||window.event; //算出点击内容 里面的位置 offx=ev.pageX-main.offset().left; offy=ev.pageY-main.offset().top; //按下过程中 $(document).bind("mousemove",function(ev){ var ev=ev||window.event; //isdraging=true; //当前鼠标的位置 var mousex= ev.pageX; var mousey= ev.pageY; // 动态算出盒子距离屏幕边缘的距离 var xinx=mousex-offx; var xiny=mousey-offy; //可视区宽高 var pagewidth=document.documentElement.clientWidth; var pageheight=document.documentElement.clientHeight; //算出盒子边缘距离屏幕的距离 var maxx=pagewidth-mainw; var maxy=pageheight-mainh; //xinx>0 并且 xinx<(页面最大宽度 - 浮层的宽度) //xiny>0 并且 xiny<(页面最大宽度 -浮层的高度) xinx=Math.min(maxx,Math.max(0,xinx)); xiny=Math.min(maxy,Math.max(0,xiny)); // 盒子的偏移量 main.css({left:xinx+"px"}) main.css({top:xiny+"px"}) }) }) //抬起 $(document).mouseup(function(){ $(this).unbind('mousemove'); }) }) </script> </body> </html>
                          Run code
                          Cut to clipboard
                            文章:纯生JS图片拖拽  发表时间:2017-09-18, 17:26:30  
                            展开↯

                            #960

                            作者:广西南宁市
                            js拖动窗口
                            <!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8"> <title>Title</title> <style> *{margin:0;padding:0} #main{ position: absolute; width: 260px; height: 260px; background: antiquewhite; top: 0; left: 0; } #con{ width: 100%; height: 30px; background: aquamarine; cursor: move; } </style> </head> <body> <div id='main'> <div id='con'>拖动我</div> </div> <script> function $(id){return document.getElementById(id);} // 居中浮层 function aurocenter(el){ // 可视区宽高 var bodyw=document.documentElement.clientWidth; var bodyh=document.documentElement.clientHeight; var elw=el.offsetWidth; var elh=el.offsetHeight; el.style.left=(bodyw-elw)/2+'px'; el.style.top=(bodyh-elh)/2+'px'; } aurocenter($('main')) var offx=0; var offy=0; var tuodong=false; //判断是否可拖动 // 鼠标按下 $('con').addEventListener('mousedown',function(ev){ var ev=ev||window.event; // 算出点击内容 里面的位置 offx= ev.pageX-$('main').offsetLeft; offy= ev.pageY-$('main').offsetTop; tuodong=true; }) // 鼠标移动 document.onmousemove=function(ev){ var ev=ev||window.event; // 鼠标当前位置 var mousex=ev.pageX; var mousey=ev.pageY; var movex=0; var movey=0; if (tuodong===true){ // 计算出盒子距离屏幕边缘的距离 movex=mousex-offx; movey=mousey-offy; // 获取可视区的宽高 var pagewidth=document.documentElement.clientWidth; var pageheight=document.documentElement.clientHeight; // 获取大盒子的宽高 var dalogW=$('main').offsetWidth; var dalogH=$('main').offsetHeight; // 算出盒子边缘距离 屏幕边缘的距离 var maxx=pagewidth-dalogW; var maxy=pageheight-dalogH; // movex>0 并且 movex<(页面最大宽度 - 浮层的宽度) movex=Math.min(maxx, Math.max(0,movex)) movey=Math.min(maxy, Math.max(0,movey)) // 盒子偏移量 $('main').style.left=movex+'px'; $('main').style.top=movey+'px'; } } // 鼠标松开 document.onmouseup=function(){ tuodong=false; } window.onresize=function(){ aurocenter($('main')); } </script> </body> </html>
                            Run code
                            Cut to clipboard
                              文章:纯生JS图片拖拽  发表时间:2017-09-18, 17:25:11  
                              展开↯

                              #961

                              作者:广西南宁市
                              谷歌浏览器更新到最新版本后发现一些js特效动画代码无效了,比如返回顶部
                              $("body").animate({"scrollTop":top})
                              Run code
                              Cut to clipboard

                                修改为,将html和body这两者都加上就可以了
                                $("html,body").animate({"scrollTop":top})
                                Run code
                                Cut to clipboard

                                  文章:常用html、demo代码  发表时间:2017-09-18, 16:58:09  
                                  展开↯

                                  #962

                                  作者:广西南宁市
                                  js判断当前页面是否激活标签
                                  JS判断用户是否正在浏览当前网页标签
                                  <script> //网页当前状态判断 var hidden, state, visibilityChange,otitle; if (typeof document.hidden !== "undefined") { hidden = "hidden"; visibilityChange = "visibilitychange"; state = "visibilityState"; } else if (typeof document.mozHidden !== "undefined") { hidden = "mozHidden"; visibilityChange = "mozvisibilitychange"; state = "mozVisibilityState"; } else if (typeof document.msHidden !== "undefined") { hidden = "msHidden"; visibilityChange = "msvisibilitychange"; state = "msVisibilityState"; } else if (typeof document.webkitHidden !== "undefined") { hidden = "webkitHidden"; visibilityChange = "webkitvisibilitychange"; state = "webkitVisibilityState"; } otitle=document.title; // 添加监听器,在title里显示状态变化 document.addEventListener(visibilityChange, function() { //document.title = document[state]; //console.log(document.visibilityState); if(document.visibilityState=='hidden') document.title = '(;°○° ) (x___x) 被离开';//(昏倒) // 被离开 // '+otitle; else document.title = otitle; }, false); //初始化页面状态 //document.title = document[state]; /*var hiddenProperty = 'hidden' in document ? 'hidden' : 'webkitHidden' in document ? 'webkitHidden' : 'mozHidden' in document ? 'mozHidden' : null; var visibilityChangeEvent = hiddenProperty.replace(/hidden/i, 'visibilitychange'); var onVisibilityChange = function(){ if (!document[hiddenProperty]) { // console.log('页面非激活'); }else{ document.title ='页面非激活'; //console.log('页面激活') } } document.addEventListener(visibilityChangeEvent, onVisibilityChange);*/ </script>
                                  Run code
                                  Cut to clipboard
                                    文章:常用html、demo代码  发表时间:2017-09-18, 16:24:24  
                                    展开↯

                                    #963

                                    作者:广西南宁市
                                    又拍云 cdn 出现 403 Forbidden 错误
                                    回源地址填写IP地址 即可,填写域名会出现 403或者超时错误。
                                    #,广西南宁市,2017-09-15,11:41:30,
                                    <!-- uppu upuu. .upuuuuup. . .uppuppuuuuppppyup uuuyuuypyyupuupyuuuu uupuynnnnnnnpuupuuuu uupppunnnnnnnypupuuu uuuyunnnnnnnnnnyuu. uuuuyyypyynnnuyyupu uuupppp. pynnpppuu. uuuppp. puuupupuu uuuupuyu .pupuuuuu uuuu puuy .puuuuu. uuuuuynnnu .uuuuu y..pppuuyunnuu uuuu. .pu.nu.nyyyuy uuuu yn..yyny...p uuuu u...n.ny.... yuuuu y....nuuupypyyunnn un.unn.yppuunnynunnn un..nynnpuupppu...np. .uu.nyunyuuuuuuup.n.n. yn...nuuuypppupuuunnuu pp..conuuyypyyyypupnny unnucoonuuypuupuuyyuypy n.npuconyyyppyppyyu.... ... ycupupppppuy.cc.nyu uu pyupuupupp.occ.nuy uuuuppypupup u.uuu uuuuuuuuuu yyy ..uyppuuuuu .upncccccccc.y .uuuuuucccccnypuuuuuu.. .uuuuuuup....upuuuuuuuuuuuuuu. .uuuuuuuuu. .uuuppuuuuuuuuuuuu uuuuuuuuu ..upuppp uuuuuuu. uuppy uuuuuuu ppupu upuuupp. puuuu upppyup. pupu .upupyp .puu upupyy pup upuuu uup .upu .pp .uuuu ppu upupu puu. pppp uuuuu. uuuu .uuuuuuu.. .pppp .. .... .pppp. -->
                                    Run code
                                    Cut to clipboard
                                      文章:程序员编程常用网页工具集[游戏]  发表时间:2017-09-15, 10:56:20  
                                      展开↯

                                      #964

                                      作者:广西南宁市
                                      文章有时候会莫名出现第一次提示文章不存在bug错误,后面再点击进去又正常
                                      #,广西南宁市,2017-09-09,17:04:01, 大厦有恙,蝼蚁先知
                                      #,广西南宁市,2017-09-09,17:25:56, 你是天生适合打工的人,别浪费自己的天赋
                                      #,广西南宁市,2017-09-09,17:27:17,
                                      这是炎热小镇慵懒的一天。太阳高挂,街道无人,每个人都债台高筑,靠信用度日。
                                      这时,从外地来了一位有钱的旅客,他进了一家旅馆,拿出一张1000元钞票放在柜台,说 想先看看房间,挑一间合适的过夜。
                                      就在此人上楼的时候,店主抓了这张1000元钞,跑 到隔壁屠户那里支付了他欠的肉钱。
                                      屠夫有了1000元,横过马路付清 了猪农的猪本钱。
                                      猪农拿了1000元,出去付了他欠的饲料款。
                                      那个卖饲料的老兄,拿到1000元赶忙去付清他召妓的钱(经济不景气,当地的服务业也不得不提供信用服务)。
                                      有了1000元 ,这名妓 女冲到旅馆付了她所欠的房钱。
                                      旅馆店主忙把这1000元放到柜台上,以免旅客下楼时起疑。
                                      此时那人正下楼来,拿起1000元, 声称没一间满意的,他把钱收进口袋,走了……这一天,没有人生产了什么东西,也没有人得到什么东西,可全镇的债务都清了,大家很开心。
                                      #,广西南宁市,2017-09-09,17:31:57, 我们这个世界如果曾经进步过一点点,那都是因为有些孩子当时没有听从父母的话。
                                      #,广西南宁市,2017-09-15,09:45:13, 过河拆桥,拆的就是这种心软的。
                                      文章:@意见反馈/技术支持/伊网/安企网  发表时间:2017-09-09, 12:16:32  
                                      展开↯

                                      #965

                                      作者:广西南宁市
                                      js 正则获取框架iframe链接src
                                      <script> var str = '<iframe frameborder="0" width="640" height="498" src="https://v.qq.com/iframe/player.html?vid=b0516dp12du&tiny=0&auto=0" allowfullscreen></iframe>'; alert(str.match(/<iframe .*?src=\"(.+?)\"/)[1]);</script>
                                      Run code
                                      Cut to clipboard
                                        展开↯

                                        #966

                                        作者:广西南宁市
                                        //获取视频数据的地址 ,getMovieUrl:URL+"php/getMovie.php" //视频数据获取地址 //工具栏上的所有的功能按钮和下拉框,可以在new编辑器的实例时选择自己需要的从新定义 , toolbars: [["fullscreen","source","undo","redo","insertunorderedlist","insertorderedlist","unlink","link","cleardoc","selectall","print","searchreplace","preview","help","insertimage","snapscreen","emotion","horizontal","anchor","spechars","blockquote","insertcode","bold","italic","underline","strikethrough","forecolor","backcolor","superscript","subscript","justifyleft","justifycenter","justifyright","justifyjustify","touppercase","tolowercase","directionalityltr","directionalityrtl","indent","removeformat","formatmatch","autotypeset","customstyle","paragraph","rowspacingbottom","rowspacingtop","lineheight","fontfamily","fontsize","imagenone","imageleft","imageright","imagecenter","inserttable","deletetable","mergeright","mergedown","splittorows","splittocols","splittocells","mergecells","insertcol","insertrow","deletecol","deleterow","insertparagraphbeforetable","insertframe"]] //当鼠标放在工具栏上时显示的tooltip提示,留空支持自动多语言配置,否则以配置值为准
                                        Run code
                                        Cut to clipboard
                                          展开↯

                                          #967

                                          作者:广西南宁市
                                          insertframe.html
                                          <!DOCTYPE html> <html> <head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8"/> <title></title> <script type="text/javascript" src="../internal.js"></script> <style type="text/css"> .warp {width: 320px;height: 153px;margin-left:5px;padding: 20px 0 0 15px;position: relative;} #url {width: 290px; margin-bottom: 2px; margin-left: -6px; margin-left: -2px\9;*margin-left:0;_margin-left:0; } .format span{display: inline-block; width: 58px;text-align: center; zoom:1;} table td{padding:5px 0;} #align{width: 65px;height: 23px;line-height: 22px;} </style> </head> <body> <div class="warp"> <table width="300" cellpadding="0" cellspacing="0"> <tr> <td colspan="2" class="format"> <span style=" width: auto; ">填写复制通用代码</span><!-- <var id="lang_input_address"></var> --> <!-- <input style="width:200px" id="url" type="text" value=""/> --> <textarea style=" width: 100%; height: 119px; " id="url" ></textarea> </td> </tr> <tr style="display:none;"> <td colspan="2" class="format"><span><var id="lang_input_width"></var></span><input style="width:200px" type="text" id="width"/> px</td> </tr> <tr style="display:none;"> <td colspan="2" class="format"><span><var id="lang_input_height"></var></span><input style="width:200px" type="text" id="height"/> px</td> </tr> <tr style="display:none;"> <td><span><var id="lang_input_isScroll"></var></span><input type="checkbox" id="scroll"/> </td> <td><span><var id="lang_input_frameborder"></var></span><input type="checkbox" id="frameborder"/> </td> </tr> <tr style="display:none;"> <td colspan="2"><span><var id="lang_input_alignMode"></var></span> <select id="align"> <option value=""></option> <option value="left"></option> <option value="right"></option> </select> </td> </tr> </table> </div> <script type="text/javascript"> var iframe = editor._iframe; if(iframe){ $G("url").value = iframe.getAttribute("src")||""; var str = $G("url").value; $G("url").value = (str.match(/<iframe .*?src=\"(.+?)\"/)[1]); $G("width").value = iframe.getAttribute("width")||iframe.style.width.replace("px","")||""; $G("height").value = iframe.getAttribute("height") || iframe.style.height.replace("px","") ||""; $G("scroll").checked = (iframe.getAttribute("scrolling") == "yes") ? true : false; $G("frameborder").checked = (iframe.getAttribute("frameborder") == "1") ? true : false; $G("align").value = iframe.align ? iframe.align : ""; } function queding(){ var url = ($G("url").value.match(/<iframe .*?src=\"(.+?)\"/)[1]),//$G("url").value.replace(/^\s*|\s*$/ig,""), width = '100%',//$G("width").value, height = '300',//$G("height").value, scroll = $G("scroll"), frameborder = $G("frameborder"), //float = $G("align").value, newIframe = editor.document.createElement("iframe"), div; if(!url){ alert(lang.enterAddress); return false; } newIframe.setAttribute("src",/http:\/\/|https:\/\//ig.test(url) ? url : "http://"+url); // /^[1-9]+[.]?\d*$/g.test( width ) ? newIframe.setAttribute("width",width) : ""; newIframe.setAttribute("width",width); // /^[1-9]+[.]?\d*$/g.test( height ) ? newIframe.setAttribute("height",height) : ""; newIframe.setAttribute("height",height) scroll.checked ? newIframe.setAttribute("scrolling","yes") : newIframe.setAttribute("scrolling","no"); frameborder.checked ? newIframe.setAttribute("frameborder","1",0) : newIframe.setAttribute("frameborder","0",0); //float ? newIframe.setAttribute("align",float) : newIframe.setAttribute("align",""); if(iframe){ iframe.parentNode.insertBefore(newIframe,iframe); domUtils.remove(iframe); }else{ div = editor.document.createElement("div"); div.appendChild(newIframe); editor.execCommand("inserthtml",div.innerHTML); } editor._iframe = null; dialog.close(); } dialog.onok = queding; $G("url").onkeydown = function(evt){ evt = evt || event; if(evt.keyCode == 13){ queding(); } }; $focus($G( "url" )); </script> </body> </html>
                                          Run code
                                          Cut to clipboard
                                            展开↯

                                            #968

                                            作者:广西南宁市
                                            <?php namespace Addons\WeiSite\Controller; use Addons\WeiSite\Controller\BaseController; class CmsController extends BaseController { var $model; function _initialize() { $this->model = $this->getModel ( 'custom_reply_news' ); parent::_initialize (); } // 通用插件的列表模型 public function lists() { // 使用提示 $normal_tips = '文章的数据来源官方自定义回复插件中的图文回复,如有异常请确认自定义回复插件是否已经安装'; $this->assign ( 'normal_tips', $normal_tips ); $map ['token'] = get_token (); session ( 'common_condition', $map ); $list_data = $this->_get_model_list ( $this->model ); // 分类数据 $map ['is_show'] = 1; $list = M ( 'weisite_category' )->where ( $map )->field ( 'id,title' )->select (); $cate [0] = ''; foreach ( $list as $vo ) { $cate [$vo ['id']] = $vo ['title']; } foreach ( $list_data ['list_data'] as &$vo ) { $vo ['cate_id'] = intval ( $vo ['cate_id'] ); $vo ['cate_id'] = $cate [$vo ['cate_id']]; } $this->assign ( $list_data ); // dump ( $list_data ); $templateFile = $this->model ['template_list'] ? $this->model ['template_list'] : ''; $this->display ( $templateFile ); } // 通用插件的编辑模型 public function edit() { $model = $this->model; $id = I ( 'id' ); if (IS_POST) { //dump($_POST);exit; $_POST['content']=str_ireplace('<iframe src="','#iframesrc#',$_POST['content']); $_POST['content']=str_ireplace('" width="100%" height="300" scrolling="no" frameborder="0"></iframe>','#/iframesrc#',$_POST['content']); $Model = D ( parse_name ( get_table_name ( $model ['id'] ), 1 ) ); // 获取模型的字段信息 $Model = $this->checkAttr ( $Model, $model ['id'] ); if ($Model->create () && $Model->save ()) { D ( 'Common/Keyword' )->set ( $_POST ['keyword'], _ADDONS, $id, $_POST ['keyword_type'], 'custom_reply_news' ); $this->success ( '保存' . $model ['title'] . '成功!', U ( 'lists?model=' . $model ['name'] ) ); } else { $this->error ( $Model->getError () ); } } else { $fields = get_model_attribute ( $model ['id'] ); $extra = $this->getCateData (); if (! empty ( $extra )) { foreach ( $fields [1] as &$vo ) { if ($vo ['name'] == 'cate_id') { $vo ['extra'] .= "\r\n" . $extra; } } } // 获取数据 $data = M ( get_table_name ( $model ['id'] ) )->find ( $id ); $data || $this->error ( '数据不存在!' ); $token = get_token (); if (isset ( $data ['token'] ) && $token != $data ['token'] && defined ( 'ADDON_PUBLIC_PATH' )) { $this->error ( '非法访问!' ); } $this->assign ( 'fields', $fields ); $data['content']=str_ireplace('#iframesrc#','<iframe src="',$data['content']); $data['content']=str_ireplace('#/iframesrc#','" width="100%" height="300" scrolling="no" frameborder="0"></iframe>',$data['content']); $this->assign ( 'data', $data ); //dump($data);exit; $this->meta_title = '编辑' . $model ['title']; $this->display (); } } // 通用插件的增加模型 public function add() { $model = $this->model; $Model = D ( parse_name ( get_table_name ( $model ['id'] ), 1 ) ); if (IS_POST) { // 获取模型的字段信息 $Model = $this->checkAttr ( $Model, $model ['id'] ); if ($Model->create () && $id = $Model->add ()) { D ( 'Common/Keyword' )->set ( $_POST ['keyword'], _ADDONS, $id, $_POST ['keyword_type'], 'custom_reply_news' ); $this->success ( '添加' . $model ['title'] . '成功!', U ( 'lists?model=' . $model ['name'] ) ); } else { $this->error ( $Model->getError () ); } } else { $fields = get_model_attribute ( $model ['id'] ); $extra = $this->getCateData (); if (! empty ( $extra )) { foreach ( $fields [1] as &$vo ) { if ($vo ['name'] == 'cate_id') { $vo ['extra'] .= "\r\n" . $extra; } } } $this->assign ( 'fields', $fields ); $this->meta_title = '新增' . $model ['title']; $this->display (); } } // 通用插件的删除模型 public function del() { parent::common_del ( $this->model ); } // 获取所属分类 function getCateData() { //$map ['is_show'] = 1; $map ['token'] = get_token (); $list = M ( 'weisite_category' )->where ( $map )->select (); foreach ( $list as $v ) { $extra .= $v ['id'] . ':' . $v ['title'] . "\r\n"; } return $extra; } }
                                            Run code
                                            Cut to clipboard
                                              展开↯

                                              #969

                                              作者:广西南宁市
                                              出现
                                              SyntaxError: Missing parentheses in call to 'print'
                                              原因:Mac安装俩个python版本,2和3,python2系列可以支持 print “xxxx” ,python系列需要使用print("xxx")
                                              文章:python基础入门安装搭建服务器开发环境教程  发表时间:2017-09-14, 14:23:36  
                                              展开↯
                                              你好,残忍屏蔽广告

                                              确定要清除编辑框内容吗?

                                              该删除操作将不可恢复。

                                              删除 取消

                                              激活Windows

                                              转到"设置"以激活Windows。