首页
📷在线壁纸
🎬娱乐天地
🔖友情链接
更多
📝留言板
Search
1
【javascript】JS-向当前url追加参数
2,343 阅读
2
【PHP】生成随机昵称
2,200 阅读
3
【PHP】判断一个字符串是否属于序列化后的数据
2,022 阅读
4
【css】html+css给文章页,做阅读全文
1,973 阅读
5
【PHP】 设计模式(23种)
1,907 阅读
📂默认分类
💓typecho
🏳️🌈代码改变世界
🍇 mysql
🍈 Winform
🍓 golang
🍉 设计模式
🥝 PHP
🍎 python
🍊 nginx
🍋 网络安全
🍍 javascript
🫑 database
🍡 AI
🍭文艺范
🍏mac
登录
Search
标签搜索
php
typecho
代码注释
redis
mysql
go
golang
nginx
thinkphp
gin
linux
curl
html
mamp
docker
算法
短网址
构造函数
webhook
代码片段
依然范儿特西
累计撰写
141
篇文章
累计收到
1
条评论
首页
栏目
📂默认分类
💓typecho
🏳️🌈代码改变世界
🍇 mysql
🍈 Winform
🍓 golang
🍉 设计模式
🥝 PHP
🍎 python
🍊 nginx
🍋 网络安全
🍍 javascript
🫑 database
🍡 AI
🍭文艺范
🍏mac
页面
📷在线壁纸
🎬娱乐天地
🔖友情链接
📝留言板
搜索到
141
篇与
的结果
2021-10-09
nginx-rewrite规则
作用场景:URL访问跳转,支持开发设计,如页面跳转,兼容性支持,展示效果等SEO优化维护:后台维护、流量转发等安全调整用户浏览的URL,看起来规范为了让搜索引擎收录网站内容,让用户体验更好网站更换新域名后根据特殊的变量、目录、客户端信息进行跳转注:nginx官方文档:http://nginx.org/en/docs/http/ngx_http_rewrite_module.html1、rewrite语法:指令语法:rewrite regex replacement[flag];默认值:none应用位置:server、location、ifrewrite是实现URL重定向的重要指令,他根据regex(正则表达式)来匹配内容跳转到replacement,结尾是flag标记简单的小例子:# 匹配成功后跳转到百度,执行永久301跳转 rewrite ^/(.*) http://www.baidu.com/ permanent;常用正则表达式:字符描述\将后面接着的字符标记为一个特殊字符或者一个原义字符或一个向后引用^匹配输入字符串的起始位置$匹配输入字符串的结束位置*匹配前面的字符零次或者多次+匹配前面字符串一次或者多次?匹配前面字符串的零次或者一次.匹配除“\n”之外的所有单个字符(pattern)匹配括号内的patternrewrite 最后一项flag参数:标记符号说明last停止rewrite检测【如果没有匹配到,会继续向下匹配】break停止rewrite检测【如果没有匹配到,则不再向下匹配,直接返回结果404redirect返回302临时重定向,地址栏会显示跳转后的地址permanent返回301永久重定向,地址栏会显示跳转后的地址
2021年10月09日
130 阅读
0 评论
4 点赞
2021-09-30
Golang之log(如何将日志写到指定文件里面)
对于Go语言的日志来说,如何将log写到指定的文件里面,下面是一个例子。如何将log 写入到指定的文件中?方法一:package main import ( "log" "os" "time" ) func init() { file := "./" +"log"+ ".txt" logFile, err := os.OpenFile(file, os.O_RDWR|os.O_CREATE|os.O_APPEND, 0766) if err != nil { panic(err) } log.SetOutput(logFile) // 将文件设置为log输出的文件 log.SetPrefix("[logTool]") log.SetFlags(log.LstdFlags | log.Lshortfile | log.LUTC) return } func main() { log.Println("Hello laofan!") // log 还是可以作为输出的前缀 return }output:// message.txt里面 显示 [logTool]2021/09/30 15:30:05 log.go:24: Hello laofan! 方法二:package main import ( "log" "os" "time" ) var loger *log.Logger func init() { file := "./" + time.Now().Format("20210930") + ".txt" logFile, err := os.OpenFile(file, os.O_RDWR|os.O_CREATE|os.O_APPEND, 0766) if err != nil { panic(err) } loger = log.New(logFile, "[logTool]",log.LstdFlags | log.Lshortfile | log.LUTC) // 将文件设置为loger作为输出 return } func main() { // 使用的时候,需要采用loger作为输出的前缀 loger.Println("Hello:laofan!") return } output:// message.txt里面 显示 [logTool]2021/09/30 15:35:20 log.go:24: Hello laofan! `` 灰子作于二零二一年九月三十日。
2021年09月30日
827 阅读
0 评论
0 点赞
2021-09-21
tree命令输出目录树层结构
你也想要生成这个目录树层结构吗?,按下面操作即可:. ├── etc │ └── greet-api.yaml ├── go.mod ├── go.sum ├── greet.api ├── greet.go └── internal ├── config │ └── config.go ├── handler │ ├── greethandler.go │ └── routes.go ├── logic │ └── greetlogic.go ├── svc │ └── servicecontext.go └── types └── types.go 7 directories, 11 files 1 、安装 tree# mac 下使用 brew包管理工具 brew install tree # linux 下使用yum安装 yum install tree2、 安装成功后,直接在终端使用,使用 --help 查看帮助信息tree --help看到如下功能usage: tree [-acdfghilnpqrstuvxACDFJQNSUX] [-H baseHREF] [-T title ] [-L level [-R]] [-P pattern] [-I pattern] [-o filename] [--version] [--help] [--inodes] [--device] [--noreport] [--nolinks] [--dirsfirst] [--charset charset] [--filelimit[=]#] [--si] [--timefmt[=]<f>] [--sort[=]<name>] [--matchdirs] [--ignore-case] [--] [<directory list>] ------- Listing options ------- -a All files are listed. -d List directories only. -l Follow symbolic links like directories. -f Print the full path prefix for each file. -x Stay on current filesystem only. -L level Descend only level directories deep. -R Rerun tree when max dir level reached. -P pattern List only those files that match the pattern given. -I pattern Do not list files that match the given pattern. --ignore-case Ignore case when pattern matching. --matchdirs Include directory names in -P pattern matching. --noreport Turn off file/directory count at end of tree listing. --charset X Use charset X for terminal/HTML and indentation line output. --filelimit # Do not descend dirs with more than # files in them. --timefmt <f> Print and format time according to the format <f>. -o filename Output to file instead of stdout. -------- File options --------- -q Print non-printable characters as '?'. -N Print non-printable characters as is. -Q Quote filenames with double quotes. -p Print the protections for each file. -u Displays file owner or UID number. -g Displays file group owner or GID number. -s Print the size in bytes of each file. -h Print the size in a more human readable way. --si Like -h, but use in SI units (powers of 1000). -D Print the date of last modification or (-c) status change. -F Appends '/', '=', '*', '@', '|' or '>' as per ls -F. --inodes Print inode number of each file. --device Print device ID number to which each file belongs. ------- Sorting options ------- -v Sort files alphanumerically by version. -t Sort files by last modification time. -c Sort files by last status change time. -U Leave files unsorted. -r Reverse the order of the sort. --dirsfirst List directories before files (-U disables). --sort X Select sort: name,version,size,mtime,ctime. ------- Graphics options ------ -i Don't print indentation lines. -A Print ANSI lines graphic indentation lines. -S Print with CP437 (console) graphics indentation lines. -n Turn colorization off always (-C overrides). -C Turn colorization on always. ------- XML/HTML/JSON options ------- -X Prints out an XML representation of the tree. -J Prints out an JSON representation of the tree. -H baseHREF Prints out HTML format with baseHREF as top directory. -T string Replace the default HTML title and H1 header with string. --nolinks Turn off hyperlinks in HTML output. ---- Miscellaneous options ---- --version Print version and exit. --help Print usage and this help message and exit. -- Options processing terminator. 3、 输出你的树层目录结构cd 目标文件夹路径然后 tree 一下,会将该层级下所有文件都遍历了输出,不管层级多深4、 常用技巧我们可以在目录遍历时使用 -L 参数指定遍历层级tree -L 2如果你想把一个目录的结构树导出到文件 Readme.md ,可以这样操作tree -L 2 >README.md //然后我们看下当前目录下的 README.md 文件只显示文件夹tree -d 显示项目的层级,n表示层级数。例:显示项目三层结构,tree -l 3;tree -L n tree -I pattern 用于过滤不想要显示的文件或者文件夹。比如要过滤项目中的node_modules文件夹;tree -I “node_modules”
2021年09月21日
124 阅读
0 评论
2 点赞
2021-09-18
markdown折叠内容语法
如题,语法是:<details> <summary>Title</summary> content!!! </details> 举例 <details> <summary>CLICK ME</summary> **<summary>标签与正文间一定要空一行!!!** </details>
2021年09月18日
160 阅读
0 评论
0 点赞
2021-09-14
清除谷歌浏览器的dns缓存
清除谷歌浏览器的dns缓存
2021年09月14日
160 阅读
0 评论
2 点赞
2021-09-13
mac下为MAMP添加php扩展msgpack
查看最新的扩展版本https://pecl.php.net/package/msgpackPHP7.2.22 的文件夹地址/Applications/MAMP/bin/php/php7.2.22wget -c https://pecl.php.net/get/msgpack-0.0.1.tgz tar zxvf msgpack.tgz cd msgpack /Applications/MAMP/bin/php/php7.2.22/bin/phpize ./configure --with-php-config=/Applications/MAMP/bin/php/php7.2.22/bin/php-config make && make install vi /Applications/MAMP/bin/php/php7.2.22/etc/php.ini #加上一行 extension=msgpack.so # 重启下php # php -m 验证
2021年09月13日
132 阅读
0 评论
2 点赞
2021-09-13
Mac终端采用mamp的PHP版本运行
查看环境变量,PHP运行的文件位置:which php终端输入,可能,bash_profile 文件并不存在,就创建新文件vi ~/.bash_profile然后把环境变量代码添加到bash_profile脚本里export PATH="/Applications/MAMP/bin/php/php7.2.22/bin:$PATH"执行文件,使起生效source ~/.bash_profile
2021年09月13日
130 阅读
0 评论
1 点赞
2021-09-03
linux 实现每秒执行&间隔 90分钟执行
前言linux crontab 命令,最小的执行时间是一分钟, 如果要在小于一分钟执行。就要换个方法来实现crontab 的延时:原理:通过延时方法 sleep N 来实现每N秒执行。crontab -e 输入以下语句,然后 :wq 保存退出。* * * * * /usr/bin/curl http://www.test.com * * * * * sleep 5; /usr/bin/curl http://www.test.com * * * * * sleep 10; /usr/bin/curl http://www.test.com * * * * * sleep 15; /usr/bin/curl http://www.test.com * * * * * sleep 20; /usr/bin/curl http://www.test.com * * * * * sleep 25; /usr/bin/curl http://www.test.com * * * * * sleep 30; /usr/bin/curl http://www.test.com * * * * * sleep 35; /usr/bin/curl http://www.test.com * * * * * sleep 40; /usr/bin/curl http://www.test.com * * * * * sleep 45; /usr/bin/curl http://www.test.com * * * * * sleep 50; /usr/bin/curl http://www.test.com * * * * * sleep 55; /usr/bin/curl http://www.test.com注意:60必须能整除间隔的秒数(没有余数),例如间隔的秒数是2,4,6,10,12等。如果间隔的秒数太少,例如2秒执行一次,这样就需要在crontab 加入60/2=30条语句。不建议使用此方法,可以使用下面介绍的第二种方法。2 shell 脚本实现原理:在sh使用for语句实现循环指定秒数执行。crontab.sh#!/bin/bash step=2 #间隔的秒数,不能大于60 for (( i = 0; i < 60; i=(i+step) )); do $(php '/home/fdipzone/php/crontab/tolog.php') sleep $step done exit 0 crontab -e 输入以下语句,然后:wq 保存退出。# m h dom mon dow command * * * * * /home/fdipzone/php/crontab/crontab.sh 使用以下命令查看结果tail -f run.log 注意:如果60不能整除间隔的秒数,则需要调整执行的时间。例如需要每7秒执行一次,就需要找到7与60的最小公倍数,7与60的最小公倍数是420(即7分钟)。则 crontab.sh step的值为7,循环结束条件i<420, crontab -e可以输入以下语句来实现# m h dom mon dow command */7 * * * * /home/fdipzone/php/crontab/crontab.sh 举一反三q : 如果需要间隔 90 分钟 执行一次,如何处理?a :把他扩大成 24小时 = 24 * 60 分钟执行次数 = 24*60 / 90 = 16也就是最大可执行 16次每次 sleep 90*60 秒即可实现 每间隔90分钟 执行一次代码实现:#!/bin/bash step=5400 #间隔的秒数 for (( i = 0; i < 16; i=(i+step) )); do $(php '/home/fdipzone/php/crontab/tolog.php') sleep $step done exit 0
2021年09月03日
736 阅读
2 评论
0 点赞
2021-09-01
Golang 获取https证书信息、过期信息
package main import ( "crypto/tls" "fmt" "net/http" ) func main() { tr := &http.Transport{ TLSClientConfig: &tls.Config{InsecureSkipVerify: true}, } client := &http.Client{Transport: tr} seedUrl := "https://richerdyoung.com" resp, err := client.Get(seedUrl) defer resp.Body.Close() if err != nil { fmt.Errorf(seedUrl," 请求失败") panic(err) } //fmt.Println(resp.TLS.PeerCertificates[0]) certInfo:=resp.TLS.PeerCertificates[0] fmt.Println("过期时间:",certInfo.NotAfter) fmt.Println("组织信息:",certInfo.Subject) } 运行结果过期时间: 2021-09-02 07:27:20 +0000 UTC 组织信息: CN=www.richerdyoung.com
2021年09月01日
323 阅读
0 评论
1 点赞
2021-08-27
linux安装homebrew
安装命令/usr/bin/ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"常用命令brew list # 查看已经安装的包 brew update # 更新Homebrew自身 brew doctor # 诊断关于Homebrew的问题(Homebrew 有问题时请用它) brew cleanup # 清理老版本软件包或者无用的文件 brew show ${formula} # 查看包信息 brew search ${formula} # 按名称搜索 brew upgrade ${formula} # 升级软件包 brew install ${formula} # 按名称安装 brew uninstall ${formula} # 按名称卸载 brew pin/unpin ${formula} # 锁定或者解锁软件包版本,防止误升级
2021年08月27日
119 阅读
0 评论
1 点赞
1
...
6
7
8
...
15