2010年02月28日

页面内附件自动下载

Filed under: JS — 标签: — cmpan @ 2010-02-28 09:47:24

很多人问页面内怎样自动下载文件
其实是很简单的,只要在页面尾部加js

1
2
3
<script type='text/javascript'>
location="附件地址";
</script>

2010年02月20日

PHP判断是否是手机客户端

Filed under: PHP » 实践经验 — 标签:, — cmpan @ 2010-02-20 22:08:41

通过user Agent即可判断客户端是否是手机

1
2
3
4
5
6
7
8
9
10
11
12
// 判断是否是手机客户端
$isWAPAgent = true;
// PC浏览器
if(preg_match('/(mozilla|m3gate|winwap|openwave)/i',
      $_SERVER['HTTP_USER_AGENT'])) {
    $isWAPAgent = false;
}
// 蜘蛛
elseif(preg_match('/(bot|spider|Slurp)/i',
      $_SERVER['HTTP_USER_AGENT'])) {
    $isWAPAgent = false;
}

2010年02月4日

字体

Filed under: 未分类 — 标签: — cmpan @ 2010-02-04 14:09:45

04font

Copyright © 2009 流水孟春 版权所有
Web技术,LAMP,Nginx,Web2.0,前端技术
Powered by WordPress & UI Designed by 流水孟春