thinkphp6.0 的 nginx 伪静态配置
// thinkphp6.0 的nginx 伪静态配置
location / {
index index.php;
# thinkphp6.0 的 nginx 伪静态配置
if (!-e $request_filename) {
rewrite ^(.*)$ /index.php?s=/$1 last;
break;
}
}
// thinkphp6.0 的nginx 伪静态配置
location / {
index index.php;
# thinkphp6.0 的 nginx 伪静态配置
if (!-e $request_filename) {
rewrite ^(.*)$ /index.php?s=/$1 last;
break;
}
}
记录win11查看以前连接过的wifi的密码
1.首先找到以前连接过wifi的名称, 以下命令可以列出以前连接过所有wifi名称信息
netsh wlan show profiles
2.查看所要查询wifi的密码, 把下面命令中的wifi名称修改为上面查询出来的wifi名称, 查询出来关键内容后面就是wifi密码
Netsh wlan show profile name="wifi名称" key=clear | find "关键内容"
3.也可以查询wifi的详细信息
Netsh wlan show profile name="wifi名称" key=clear
css实现网站变灰代码
html {
filter: grayscale(100%);
-webkit-filter: grayscale(100%);
-moz-filter: grayscale(100%);
-ms-filter: grayscale(100%);
-o-filter: grayscale(100%);
}
1、中文截取:mb_substr()。
mb_substr(s t r , str,str,start,l e n g t h , length,length,encoding)
实例
echo mb_substr('这个真的很nice',0,3,'utf-8'); //输出这个真
2、英文截取:用substr()函数。如果截取的字符串是多个字节,就会出现乱码。
在utf8编码下,由于一个汉字占3个字节。
$str = 'hello';
echo substr($str,1,2);//输出el
3、$str[0],将字符串看做字符集合,中文不适用。
$str = 'hello';
echo $str[0];//输出h
php字符串的截取方式记录,方便以后忘记查询。
CentOS 7.0默认使用的是firewall作为防火墙,这里改为iptables防火墙。
关闭firewall:
systemctl stop firewalld.service #停止firewall
systemctl disable firewalld.service #禁止firewall开机启动
安装iptables防火墙
yum install iptables-services #安装
vim /etc/sysconfig/iptables #编辑防火墙配置文件
:INPUT ACCEPT [0:0]
:FORWARD ACCEPT [0:0]
:OUTPUT ACCEPT [0:0]
-A INPUT -m state --state ESTABLISHED,RELATED -j ACCEPT
-A INPUT -p icmp -j ACCEPT
-A INPUT -i lo -j ACCEPT IT网,http://www.it.net.cn
-A INPUT -m state --state NEW -m tcp -p tcp --dport 22 -j ACCEPT
-A INPUT -m state --state NEW -m tcp -p tcp --dport 80 -j ACCEPT
-A INPUT -m state --state NEW -m tcp -p tcp --dport 3306 -j ACCEPT
-A INPUT -j REJECT --reject-with icmp-host-prohibited
-A FORWARD -j REJECT --reject-with icmp-host-prohibited
COMMIT
:wq! #保存退出
systemctl restart iptables.service #最后重启防火墙使配置生效
systemctl enable iptables.service #设置防火墙开机启动
vi /etc/selinux/config
#SELINUX=enforcing #注释掉
#SELINUXTYPE=targeted #注释掉
SELINUX=disabled #增加
:wq! #保存退出
setenforce 0 #使配置立即生效
目标
每天晚上12点备份网站所有文件和数据库,只保留最近5天的数据。
不做好数据备份,到时会死的很惨。
shell脚本
vim backup.sh
脚本内容
#!/bin/sh
#日期
rq=`date +%Y%m%d`
#我的备份目录是/apps/backup/,5是几天前的数据
find /apps/backup/ -name "*.sql" -mtime +5 |xargs rm -fr
find /apps/backup/ -name "*.tar.gz" -mtime +5 |xargs rm -fr
#需要先安装zip,yum install zip -y
zip -r /apps/backup/wordpress_koukou_$rq.tar.gz /apps/koukou/*
mysqldump -umysql用户名 -pmysql用户密码 -h 127.0.0.1 数据库名 > /apps/backup/koukou`date +%Y-%m-%d_%H%M%S`.sql
给脚本可执行权限
chmod 777 /backup.sh
计划任务
#我的脚本目录在/apps/backup/,每天凌晨23:59执行备份
59 23 * * * sh /apps/backup/backup.sh
<?php
use Carbon\CarbonPeriod;
$period = CarbonPeriod::create('2022-06-14', '2022-06-20');
// Iterate over the period
foreach ($period as $date) {
echo $date->format('Y-m-d') ."\n";
}
//result
2022-06-14
2022-06-15
2022-06-16
2022-06-17
2022-06-18
2022-06-19
2022-06-20
//vue html渲染标签,绑定test方法
<div v-html="data" @click="test"></div>
//html渲染内容
//<button type="button" class="btn">按钮</button>
methods:{
//隐藏内容事件
test(event) {
// console.log(event)
if (event.target.className === 'btn') {
//处理逻辑
alert('yes');
}
}
}
<?php
$array = [
[
'title' => '标题5',
'views' => 500
],
[
'title' => '标题3',
'views' => 300
],
[
'title' => '标题2',
'views' => 200
],
[
'title' => '标题4',
'views' => 400
],
[
'title' => '标题1',
'views' => 100
],
];
usort($array, function ($item1, $item2) {
return $item1['views'] < $item2['views'];
});
print_r($array);
#result:
Array
(
[0] => Array
(
[title] => 标题5
1,042 views => 500
)
[1] => Array
(
[title] => 标题4
1,042 views => 400
)
[2] => Array
(
[title] => 标题3
1,042 views => 300
)
[3] => Array
(
[title] => 标题2
1,042 views => 200
)
[4] => Array
(
[title] => 标题1
1,042 views => 100
)
)
jQuery.validator.addMethod("check_user", function(value, element) {
var check = /^[A-Za-z\s]+$/;
//this.optional(element)如果元素为空并且不需要,则立即返回true。
return this.optional(element) || (check.test(value));
}, '必须是大小写字母或者空格');
rules: {
user: {
required: true,
maxlength: 15,
check_user:true,//自定义验证规则
},
}