摘要: /* * 递归求得目录大小 * @param $dir 目录 */ function dirsize($dir){ $allsize = 0; $handle = opendir($dir); while($file = readdir($handle)){ if($f... 阅读全文
posted @ 2016-03-30 11:29 王大西 阅读(117) 评论(0) 推荐(0) 编辑
摘要: 目录 opendir readdir closedir mkdir rmdir : 只能删除空目录 文件 filetype filesize is_file basename dirname pathinfo unlink : 删除文件 fopen : r:只读 r+:文件开头读写 w:只写 覆盖内 阅读全文
posted @ 2016-03-30 11:28 王大西 阅读(218) 评论(0) 推荐(0) 编辑
摘要: cookie 1. 用户浏览器支持cookie功能,就可以使用setcookie来客户端新建一个cookie 2.通过HTTP标头发送设置,因此必须在输出内容前setcookie setcookie($name,$value,$expire,$path,$domain,$secure) $value 阅读全文
posted @ 2016-03-29 16:35 王大西 阅读(152) 评论(1) 推荐(0) 编辑
摘要: prepare($sql); $st->execute(array($sid)); //没有数据 if(!$result = $st->fetch(PDO::FETCH_ASSOC)){ return ''; } //用户更换了浏览器或者IP地址... 阅读全文
posted @ 2016-03-29 14:38 王大西 阅读(447) 评论(0) 推荐(0) 编辑
摘要: query("set names utf8"); }catch( PDOException $e){ echo '链接失败 ' . $e->getMessage(); } $pdoStatement = $dbh->prepare("insert into admin(name,age) values (?,?)"); $pdoStateme... 阅读全文
posted @ 2016-03-29 10:47 王大西 阅读(160) 评论(0) 推荐(0) 编辑
摘要: /* * 事物处理线性操作。 * 以转账为例 */ header('Content-type:text/html;charset=utf-8'); $opt = array(PDO::ATTR_PERSISTENT => TRUE); $dsn = "mysql:dbname=0328;h... 阅读全文
posted @ 2016-03-28 18:03 王大西 阅读(288) 评论(1) 推荐(1) 编辑
摘要: mysql 字符串的截取 left() 、right() 、 substring()【 mid() 、substr() 等价于substring() 】 、substring_index() left(str,num) 截取字符串str左边num个字符 right(str,num) 截取字符串str 阅读全文
posted @ 2016-03-28 10:41 王大西 阅读(511) 评论(0) 推荐(0) 编辑
摘要: 用 html file控件上传图片,因为 $_FILES["file"] 是传到当前服务器,想要上传到另外一个服务器需要通过服务器脚本实现。 1.图片上传 引入jquery 和 ajaxfileupload 两个js文件 2.当前服务器接收图片,将图片保存到当前服务器上。 3.调用目的服务器的脚本, 阅读全文
posted @ 2016-03-23 15:12 王大西 阅读(716) 评论(0) 推荐(0) 编辑
摘要: from_unixtime(time); from_unixtime(time,'%Y%m%d'); from_unixtime(time,'%Y年%m月%d日'); 阅读全文
posted @ 2016-03-23 14:49 王大西 阅读(447) 评论(0) 推荐(0) 编辑
摘要: 1.如果是gbk存储 order by name asc 2.非GBK order by convert(name using gbk) asc 阅读全文
posted @ 2016-03-23 14:45 王大西 阅读(760) 评论(0) 推荐(0) 编辑