摘要: 1 get(self::session_key($PHPSESSID));37 38 if($val===false || $val==null){39 return false;40 }41 ... 阅读全文
posted @ 2015-04-19 22:41 北京流浪儿 阅读(372) 评论(0) 推荐(0) 编辑
摘要: 1 prepare($sql); 45 $smit->execute(array($PHPSESSID)); 46 47 if(!$result = $smit->fetch(PDO::FETCH_ASSOC)) 48 {... 阅读全文
posted @ 2015-04-19 22:39 北京流浪儿 阅读(472) 评论(0) 推荐(0) 编辑
摘要: 1 _observers[] = $sub; 9 }10 11 //外部统一调用12 public function trigger(){13 if(!empty($this->_observers))... 阅读全文
posted @ 2015-04-19 21:44 北京流浪儿 阅读(128) 评论(0) 推荐(0) 编辑
摘要: 1 ';13 }14 }15 16 //类适配器模式17 class Adapter implements Target{18 private $adatee;19 public function __construct(Adatee $adatee){20 ... 阅读全文
posted @ 2015-04-19 21:42 北京流浪儿 阅读(137) 评论(0) 推荐(0) 编辑
摘要: 1 <?php 2 /* 3 1、每个页面都必须开启session_start()后才能在每个页面里面使用session。 4 5 2、session_start()初始化session,第一次访问会生成一个唯一会话ID保存在客户端(是基于cookie保存的),用户下次访问时,session_... 阅读全文
posted @ 2015-04-19 21:40 北京流浪儿 阅读(344) 评论(0) 推荐(0) 编辑
摘要: 1 _weapon = $weapon;48 }49 public function cost(){50 return $this->_weapon->cost() + $this->_price;51 }52 53 public f... 阅读全文
posted @ 2015-04-19 21:38 北京流浪儿 阅读(166) 评论(0) 推荐(0) 编辑
摘要: 1 2 事件 3 4 5 6 7 8 9 跳转 10 11 12 13 阅读全文
posted @ 2015-04-19 21:22 北京流浪儿 阅读(339) 评论(0) 推荐(0) 编辑
摘要: function getBrowser(){ var userAgent = navigator.userAgent, rMsie = /(msie\s|trident.*rv:)([\w.]+)/, rFirefox = /(firefox)\/([\w.]+)/, rChrome = /(... 阅读全文
posted @ 2015-04-19 21:21 北京流浪儿 阅读(240) 评论(0) 推荐(0) 编辑
摘要: 从搜索引擎优化角度出发,301重定向是网址重定向最为可行的一种办法。当网站的域名发生变更后,搜索引擎只对新网址进行索引,同时又会把旧地址下原有的外部链接如数转移到新地址下,从而不会让网站的排名因为网址变更而收到丝毫影响。同样,在使用301永久性重定向命令让多个域名指向网站主域时,亦不会对网站的排名产... 阅读全文
posted @ 2015-04-19 21:17 北京流浪儿 阅读(218) 评论(0) 推荐(0) 编辑
摘要: 1 <?php 2 $filepath = 'http://www.vip.com/down'; 3 $fp = fopen($filepath,"r"); 4 Header("Content-type: application/octet-stream"); 5 Header("Accept-R... 阅读全文
posted @ 2015-04-19 21:13 北京流浪儿 阅读(414) 评论(0) 推荐(0) 编辑
摘要: 1 "yuejide@163.com","password"=>"yuejide198225","remember"=>0); 3 $data = http_build_query($post_data); 4 $ch = curl_init(); 5 curl_setopt($ch, CU... 阅读全文
posted @ 2015-04-19 21:10 北京流浪儿 阅读(205) 评论(0) 推荐(0) 编辑
摘要: PHP中的全局变量$_SERVER['PATH_INFO']是一个很有用的参数,众多的CMS系统在美化自己的URL的时候,都用到了这个参数。对于下面这个网址:http://www.test.com/index.php/foo/bar.html?c=index&m=search我们可以得到$_SERV... 阅读全文
posted @ 2015-04-19 21:08 北京流浪儿 阅读(1272) 评论(0) 推荐(0) 编辑
摘要: 1、通过buffer来实现需要用file_put_contents ob_get_clean()等内置函数ob_start ();include "filterpost.html";$mtime = filemtime("./filterpost.html");//在这里可以判断文件是否存在和过期,... 阅读全文
posted @ 2015-04-19 20:46 北京流浪儿 阅读(197) 评论(0) 推荐(0) 编辑
摘要: PHP防SQL注入攻击 收藏没有太多的过滤,主要是针对php和mysql的组合。一般性的防注入,只要使用php的 addslashes 函数就可以了。以下是一段copy来的代码:PHP代码$_POST = sql_injection($_POST); $_GET = sql_injection($_... 阅读全文
posted @ 2015-04-19 20:45 北京流浪儿 阅读(294) 评论(0) 推荐(0) 编辑