前段时间在网络上找的代码,修改了一部分用在了项目里。原博客地址找不到了,如果原作者看到的话留言我,将于第一时间删除。 //js本地图片预览,兼容ie[6-9]、火狐、Chrome17+、Opera11+、Maxthon3 function PreviewImage(fileObj) {//创建dom元素var divPreviewId = 'divPreview_' + fileObj
阅读全文 人气:96更新时间:2017-09-25
无缝循环marquee滚动JS代码实现,兼容IE, FireFox, Chrome,供大家参考,具体内容如下 首先是CSS和HTML如下: #marquee_zxd { border: 1px solid red; white-space: nowrap; overflow: hidden; width: 500px; padding-top: 5px; } #marquee_zxd img { height: 100px; } 下面是JS实现marquee_zxd.js: /**除了Chrome以外的浏览器可
阅读全文 人气:83更新时间:2017-09-25
!DOCTYPE html html lang=zh-CN head meta charset=utf-8 meta http-equiv=X-UA-Compatible content=IE=edge meta name=viewport content=width=device-width, initial-scale=1, user-scalable=no titleXXX/title link rel=stylesheet href=http://www.3lian.com/edu/2017/05-22/lib/bootstrap/css/bootstrap.css link rel=stylesheet href=http://www.3lian.com/edu/2017/05
阅读全文 人气:90更新时间:2017-09-25
!DOCTYPE html html lang=zh-CN head meta charset=utf-8 meta http-equiv=X-UA-Compatible content=IE=edge meta name=viewport content=width=device-width, initial-scale=1, user-scalable=no titleXXX/title link rel=stylesheet href=http://www.3lian.com/edu/2017/05-22/lib/bootstrap/css/bootstrap.css link rel=stylesheet href=http://www.3lian.com/edu/2017/05
阅读全文 人气:123更新时间:2017-09-25
#!/usr/bin/env pythonfrom Crypto.Cipher import AESimport base64import os# the block size for the cipher object; must be 16, 24, or 32 for AESBLOCK_SIZE = 32# the character used for padding--with a block cipher such as AES, the value# you encrypt must be a multiple of BLOCK_SIZE in length. This character is# used to ensure that your value is alway
阅读全文 人气:201更新时间:2017-09-24
foreach (glob(modules/*.php) as $filename) { echo $filename;} 2. 利用Linux下的ls命令 function iterator($pattern, $__FILE__) { preg_match(/^(.+)\/[^\/]+$/, $__FILE__, $matches); $ls = `ls $matches[1]/$pattern`; $ls = explode(\n, $ls); array_pop($ls); // remove empty line ls always prints foreach ($ls as $inc) { echo($inc); }}iterator(modules
阅读全文 人气:135更新时间:2017-09-24
如果是小文件,可以一次性读入到数组中,使用方便的数组计数函数进行词频统计(假设文件中内容都是空格隔开的单词): ?php$str = file_get_contents(/path/to/file.txt); //get string from filepreg_match_all(/\b(\w+[-]\w+)|(\w+)\b/,$str,$r); //place words into array $r - this includes hyphenated words$w
阅读全文 人气:196更新时间:2017-09-24
Yii2和Yii1.x的区别 Yii2里面日志的使用方法和Yii 1.x并不相同, 在Yii 1.x中,记录日志的方法为 Yii::log($message, $level, $category);Yii::trace($message, $category); 后者仅在调试模式下记录日志。 这里的log方法是YiiBase的静态方法。 在Yii2中,面向对象的设计贯彻得更加彻底,日志记录
阅读全文 人气:164更新时间:2017-09-24
因为原文中延续了组合模式的代码示例来讲访问者模式 所以这里就合并一起来复习了。但主要还是讲访问者模式。顾名思义这个模式会有一个访问者类(就像近期的热播剧人民的名义中的检查官,跑到到贪官家里调查取证,查实后就定罪),被访问者类调用访问者类
阅读全文 人气:141更新时间:2017-09-23
在yii框架中使用参数化进行IN查询时,结果不如所愿 $sql =SQLSELECT id FROM tb WHERE id IN(:ids)SQL;$db = GeneralService::getSlaveDB();$result = $db-createCommand($sql)-query([':ids' = '1013,1015,1017'])-readAll();print_r($result); Array( [0] = Array([id] = 1013)) 于是翻了yii框架中相关源码,发现采用的是pdo查询,
阅读全文 人气:191更新时间:2017-09-23