03 2018 档案

摘要:left join 左连接 以左表为准,但是如果右表也有查询条件时,需要特别注意: 比如这样,只能获取到左右表都符合条件的数据: SELECT a.id,b.status FROM bw_home_message a right join bw_home_message_log as b on a. 阅读全文
posted @ 2018-03-28 14:09 学知无涯 阅读(125) 评论(0) 推荐(0) 编辑
摘要:将身高字段设置为float类型,保留一位小数: 阅读全文
posted @ 2018-03-24 09:38 学知无涯 阅读(561) 评论(0) 推荐(0) 编辑
摘要:当表单提交的数据的字符串长度太大时,可以考虑压缩后再存储: 一、存储时: 阅读全文
posted @ 2018-03-19 11:12 学知无涯 阅读(110) 评论(0) 推荐(0) 编辑
摘要:function delDirAndFile($path, $delDir = FALSE){ if (is_array($path)) { foreach ($path as $subPath) delDirAndFile($subPath, $delDir); } if (is_dir($pat 阅读全文
posted @ 2018-03-14 20:08 学知无涯 阅读(132) 评论(0) 推荐(0) 编辑
摘要:$file = fopen('data.txt','a+') or die('Unable to open file!');fwrite($file,"\r\n".'hahah');fclose($file);windows中,注意:使用双引号\n\r才可以换行,单引号不可以,\n\r也不可以。 l 阅读全文
posted @ 2018-03-14 11:52 学知无涯 阅读(550) 评论(0) 推荐(0) 编辑
摘要:共享锁定(读取的程序),LOCK_SH独占锁定(写入的程序),LOCK_EX释放锁定(无论共享或独占),LOCK_UN如果不希望 flock() 在锁定时堵塞,则给 lock 加上 LOCK_NB 小示例:$file = fopen('data.txt','a+') or die('Unable t 阅读全文
posted @ 2018-03-14 11:44 学知无涯 阅读(218) 评论(0) 推荐(0) 编辑
摘要:ENT_COMPAT - 默认。仅解码双引号。 ENT_QUOTES - 解码双引号和单引号。 ENT_NOQUOTES - 不解码任何引号。 阅读全文
posted @ 2018-03-13 16:58 学知无涯 阅读(187) 评论(0) 推荐(0) 编辑
摘要:在实际工作中,有时需要执行mysql数据库的导入和导入操作,但对于大型sql文件导入时,phpmyadmin是不行的,有太多限制,比如记录,内存等! 导出命令: a)导出整个库 mysqldump -u 用户名 -p 数据库名 > 导出的文件名 示例: mysqldump -u root -p st 阅读全文
posted @ 2018-03-13 16:48 学知无涯 阅读(151) 评论(0) 推荐(0) 编辑
摘要://获取汉字的首字母function getFirstCharters($str){ if (empty($str)) { return ''; } //取出参数字符串中的首个字符 $temp_str = substr($str,0,1); if(ord($temp_str) > 127){ $st 阅读全文
posted @ 2018-03-07 11:18 学知无涯 阅读(198) 评论(0) 推荐(0) 编辑
摘要:/** * 根据出生年月日计算出年龄 * @param $birth_year * @param $birth_month * @param $birth_day * @return int */function getAgeByBirth($birth_year,$birth_month,$bir 阅读全文
posted @ 2018-03-07 11:10 学知无涯 阅读(523) 评论(0) 推荐(0) 编辑
摘要:菜鸟一枚,欢迎各位评论和指正,谢谢! /** * 格式化时间 * @param $time 时间戳 * @return bool|string */function formatTimeToNow($time){ //获取现在的时间戳 $nowtime = time(); if($time>$now 阅读全文
posted @ 2018-03-07 11:06 学知无涯 阅读(212) 评论(0) 推荐(0) 编辑
摘要:$userModel = M('user');//实例化用户表$addressTable = C('DB_PREFIX') . 'address';//地址表$user_info = $userModel ->alias('a') ->join("left join $addressTable b 阅读全文
posted @ 2018-03-07 10:26 学知无涯 阅读(107) 评论(0) 推荐(0) 编辑
摘要:生成订单简单示例流程: 阅读全文
posted @ 2018-03-07 10:13 学知无涯 阅读(285) 评论(0) 推荐(0) 编辑