2022年9月8日

网页整体变成灰色

摘要: <head> <style> html { -webkit-filter: grayscale(100%); -moz-filter: grayscale(100%); -ms-filter: grayscale(100%); -o-filter: grayscale(100%); filter:p 阅读全文

posted @ 2022-09-08 10:11 小馬過河﹎ 阅读(166) 评论(0) 推荐(0)

ThinkPHP上传图片压缩尺寸

摘要: function layuiUpload($path = '') { $upload = new \Think\Upload(); $upload->maxSize = 2097152; $upload->exts = ['jpg', 'jpeg', 'png', 'gif', 'doc', 'do 阅读全文

posted @ 2022-09-08 10:10 小馬過河﹎ 阅读(63) 评论(0) 推荐(0)

linux删除session文件

摘要: #!/bin/sh find /var/lib/php5 -type f -mtime +2 -exec rm -f {} \; -type f是指定文件类型为普通文件。 -mtime +2是指修改时间距离现在2天的文件。 -2是指修改时间距离现在不足2天的文件 -exec rm -f指执行删除匹配 阅读全文

posted @ 2022-09-08 10:08 小馬過河﹎ 阅读(107) 评论(0) 推荐(0)

php过滤回车/换行符

摘要: 不推荐 str_replace(PHP_EOL, '', $str); 推荐 preg_replace("/[\r\n]+/", '', $str); trim()函数也可以过滤所有两边的空格和特殊字符 \trim($str); 阅读全文

posted @ 2022-09-08 10:05 小馬過河﹎ 阅读(92) 评论(0) 推荐(0)

记一次curl无返回值的调试

摘要: 问题 php curl 执行post发现无返回值 调试 直接输出后发现是乱码 curl_setopt($ch, CURLOPT_RETURNTRANSFER, false); 解决 核心代码 $output = mb_convert_encoding($output, 'UTF-8', 'UTF-8 阅读全文

posted @ 2022-09-08 09:52 小馬過河﹎ 阅读(940) 评论(0) 推荐(0)

CentOS 扩容系统盘&挂载数据盘

摘要: 系统盘扩容 yum install -y cloud-utils-growpart growpart /dev/vda 1 xfs_growfs / 宝塔面板挂载数据盘 yum install wget -y && wget -O auto_disk.sh http://download.bt.cn 阅读全文

posted @ 2022-09-08 09:47 小馬過河﹎ 阅读(24) 评论(0) 推荐(0)

2022年9月7日

从数组中获取随机元素

摘要: JavaScript const sample = arr => arr[Math.floor(Math.random() * arr.length)] Examples sample([3, 7, 9, 11]) // 9 阅读全文

posted @ 2022-09-07 11:02 小馬過河﹎ 阅读(15) 评论(0) 推荐(0)

计算两个或多个数字的平均值

摘要: JavaScript const avg = (...nums) => nums.reduce((acc, val) => acc + val, 0) / nums.length Examples avg(...[1, 2, 3]) // 2 avg(1, 2, 3) // 2 阅读全文

posted @ 2022-09-07 10:55 小馬過河﹎ 阅读(45) 评论(0) 推荐(0)

从数组中删除虚假值

摘要: 过滤掉虚假值:false, null, 0, "", undefined, NaN JavaScript const compact = arr => arr.filter(Boolean) Examples compact([0, 1, false, 2, '', 3, 'a', 'e' * 23 阅读全文

posted @ 2022-09-07 10:31 小馬過河﹎ 阅读(23) 评论(0) 推荐(0)

计算两个或多个数字/数组的总和

摘要: JavaScript const sum = (...arr) => [...arr].reduce((acc, val) => acc + val, 0) Examples sum(1, 2, 3, 4) // 10 sum(...[1, 2, 3, 4]) // 10 阅读全文

posted @ 2022-09-07 10:18 小馬過河﹎ 阅读(29) 评论(0) 推荐(0)

导航