2021年1月8日

写一个SQL: student(Sno, Sname, classId, grade )查出每个班成绩前三名的同学

摘要: SELECT * FROM student stu WHERE ( SELECT COUNT(*) FROM student WHERE stu.classid=classid AND stu.grade >= grade GROUP BY classid HAVING COUNT(*)<=3 ) 阅读全文

posted @ 2021-01-08 15:11 沉淀物 阅读(639) 评论(0) 推荐(1) 编辑

preg_replace_callback()

摘要: preg_replace_callback 函数执行一个正则表达式搜索并且使用一个回调进行替换。 // 将文本中的年份增加一年. $text = "April fools day is 04/01/2002\n"; $text.= "Last christmas was 12/24/2001\n"; 阅读全文

posted @ 2021-01-08 09:37 沉淀物 阅读(1063) 评论(0) 推荐(0) 编辑

没有设置数据库编码为utf8mb4时 emoji表情存储

摘要: //对emoji表情转义,存入时使用 public function emoji_encode($str) { $strEncode = ''; $length = mb_strlen($str, 'utf-8'); for ($i = 0; $i < $length; $i++) { $_tmpS 阅读全文

posted @ 2021-01-08 09:33 沉淀物 阅读(101) 评论(0) 推荐(0) 编辑

2020年9月3日

生成一个唯一的 ID

摘要: uniqid() 函数基于以微秒计的当前时间,生成一个唯一的 ID。 阅读全文

posted @ 2020-09-03 20:19 沉淀物 阅读(74) 评论(0) 推荐(0) 编辑

2020年7月23日

php unicode 转换成中文

摘要: 把unicode 扔进josn里,再转成数组就变成中文了 $json = '{"str":"'.$unicode_str.'"}'; $arr = json_decode($json,true); return $arr['str']; 阅读全文

posted @ 2020-07-23 10:46 沉淀物 阅读(187) 评论(0) 推荐(0) 编辑

2020年7月13日

unset与内存容器

摘要: https://blog.csdn.net/weixin_34178244/article/details/92008641 https://www.cnblogs.com/aademeng/articles/6224054.html 变量容器在”refcount“变成0时就被销毁 把一个变量赋值给 阅读全文

posted @ 2020-07-13 11:52 沉淀物 阅读(131) 评论(0) 推荐(0) 编辑

2020年7月1日

try { }catch(Exception $e){ } 输出错误信息

摘要: try { }catch(Exception $e){ echo $e->getMessage(); //获取错误信息 echo $e->getLine(); //获取发生错误的行 echo $e->getFile();//获取发生错误的文件 echo $e->getCode();//获取错误码 } 阅读全文

posted @ 2020-07-01 16:40 沉淀物 阅读(725) 评论(0) 推荐(0) 编辑

2020年6月15日

php数组通过值获得键

摘要: array_search($value,$array)//返回key 阅读全文

posted @ 2020-06-15 10:40 沉淀物 阅读(175) 评论(0) 推荐(0) 编辑

2020年6月13日

php 重定向

摘要: header('Location: http://www.baidu.com/') ; 阅读全文

posted @ 2020-06-13 10:12 沉淀物 阅读(78) 评论(0) 推荐(0) 编辑

php 数组排序

摘要: sort($array); //数组升序排序 rsort($array); //数组降序排序 asort($array); //根据值,以升序对关联数组进行排序 ksort($array); //根据建,以升序对关联数组进行排序 arsort($array); //根据值,以降序对关联数组进行排序 阅读全文

posted @ 2020-06-13 09:42 沉淀物 阅读(147) 评论(0) 推荐(0) 编辑

导航