摘要: 有两个方法,一个使用JS实现,一个是用iframe实现。首先是JS实现,废话就不多说了,上代码function createXMLHttpRequest(){ if(window.XMLHttpRequest){ XMLHttpR = new XMLHttpRequest(); }else if(window.ActiveXObject){ try{ XMLHttpR = new ActiveXObject("Msxml2.XMLHTTP"); }catch(e){ try{ ... 阅读全文
posted @ 2012-09-20 10:59 朱辉 阅读(44986) 评论(0) 推荐(1) 编辑
摘要: 1. PHP可阅读随机字符串 此代码将创建一个可阅读的字符串,使其更接近词典中的单词,实用且具有密码验证功能。/************** *@length - length of random string (must be a multiple of 2) **************/ function readable_random_string($length = 6){ $conso=array("b","c","d","f","g","h","j&q 阅读全文
posted @ 2012-06-05 15:21 朱辉 阅读(297) 评论(0) 推荐(0) 编辑
摘要: 在百度里可以找到很多关于PHP分页的代码,但是个人觉得效果不是我想要的,于是就用某一份代码来自己加以修改看代码,效果你们可以自己测试class PageLink { /* 分页显示参数设置 */ private $db_table = ""; private $db_table_field = ""; //要显示的数据库中的字段 private $condition = ""; //查询条件 private $sort = ""; //排序条件 private $page_size = 0; //每页显示的记录数目 阅读全文
posted @ 2012-06-04 17:58 朱辉 阅读(473) 评论(0) 推荐(0) 编辑
摘要: 用到的函数 ignore_user_abort(),set_time_limit(0),sleep($interval)此代码只要运行一次后关闭浏览器即可。ignore_user_abort();//关掉浏览器,PHP脚本也可以继续执行.set_time_limit(0);// 通过set_time_limit(0)可以让程序无限制的执行下去$interval=60*30;// 每隔半小时运行do{ //这里是你要执行的代码 sleep($interval);// 等待5分钟}while(true); 阅读全文
posted @ 2012-06-04 17:37 朱辉 阅读(177) 评论(0) 推荐(0) 编辑
摘要: 相信很多人都想过如何用PHP生成GIF动画来实现动态图片验证码,以下是实现过程。ImageCode函数通过GIFEncoder类实现的GIF动画的PHP源代码,有兴趣的朋友可以研究一下。 /** * ImageCode 生成GIF图片验证 * @param $string 字符串 * @param $width 宽度 * @param $height 高度 * */ function ImageCode($string = '', $width = 75, $height = 25){ $authstr = $string ? $string :((time()%2... 阅读全文
posted @ 2012-06-04 17:04 朱辉 阅读(468) 评论(0) 推荐(0) 编辑