将composer更新到最新版本

将composer更新到最新版本

将composer更新到最新版本查看当前安装的版本 composer -v将composer 更新到最新版本执行命令 composer selfupdate 或者 composer self-update

技术 2020-10-29 PM 1474℃ 0条
go 创建文件读取文件写入文件删除文件

go 创建文件读取文件写入文件删除文件

package main import ( "bufio" "fmt" "io" "os" ) func readtxt(filename string){ file,err:=os.Open(filename) if err!=nil { fmt.Println(err) } defer file.Close() //创建一个新的io.Reader,它实现了Read方法 reader:=bufio.Ne...

Goland 2020-10-29 PM 1534℃ 0条
PHP检测敏感词,敏感词库整理

PHP检测敏感词,敏感词库整理

<?php /** * 检测关键字 * @param $content 需要检测的内容 */ function checkKeyWords(String $content) { $file_path = "keywords"; // 文件的绝对路径 // 检测文件是否存在 if (file_exists($file_path)) { $fp = fopen($file_path, "r"); // 以只读的方式打开 $str = ""; whi...

PHP 2020-10-29 PM 2874℃ 0条
go Base64 编码解码

go Base64 编码解码

package main import b64 "encoding/base64" import "fmt" func main() { data := "abc123!?$*&()'-=@~" sEnc := b64.StdEncoding.EncodeToString([]byte(data)) fmt.Println(sEnc) sDec, _ := b64.StdEncoding.DecodeString(sEnc) fmt.Println(string(sDec))...

Goland 2020-10-26 PM 1522℃ 0条
go 伪造User-Agent 抓取网页代码

go 伪造User-Agent 抓取网页代码

package main import ( "fmt" "io/ioutil" "net/http" "time" ) func main() { client := &http.Client{ Timeout: 2 * time.Second, } req, _ := http.NewRequest("GET", "http://www.xxxx.vip", nil) req...

Goland 2020-10-26 PM 1543℃ 0条
go 获取自身路径

go 获取自身路径

package main import ( "fmt" "syscall" "unicode/utf16" "unsafe" ) var( kernel=syscall.MustLoadDLL("kernel32.dll") getModuleFileNameProc = kernel.MustFindProc("GetModuleFileNameW") ) func getExePath() (exePath s...

Goland 2020-10-26 PM 1343℃ 0条
goland 提交表单

goland 提交表单

package main import ( "net/http" "net/url" "fmt" "io/ioutil" ) func main() { //?mod=forumdisplay&fid=42 params:=url.Values{ "action":{"add"}, "name":{"42"}, "tel":{"13...

Goland 2020-10-26 PM 1495℃ 0条
go字符串的遍历输出

go字符串的遍历输出

package main import ( "fmt" ) func main() { str := "Hello,世界" //方法一:格式化打印 for _, ch1 := range str { fmt.Printf("%q",ch1) //单引号围绕的字符字面值,由go语法安全的转义 } fmt.Println("==========>方法二") //方法二:转化输出格式 for _, ch2 := range s...

Goland 2020-10-26 PM 1407℃ 0条
go 正则贪婪匹配

go 正则贪婪匹配

package main import ( "fmt" "regexp" ) func main(){ r,_:=regexp.Compile("aaa(.*?)bbb") matches:=r.FindAllString("42342342aaa111111111111bbbasdfafasdfas",-1) // %q quote element to see... instead of %s fmt.Printf("%q \n"...

Goland 2020-10-26 PM 1684℃ 0条
go UTF-8 to gbk 编码转换

go UTF-8 to gbk 编码转换

examplepackage main import "fmt" import "github.com/axgle/mahonia" func main(){ enc:=mahonia.NewEncoder("gbk") //converts a string from UTF-8 to gbk encoding. fmt.Println(enc.ConvertString("hello,世界")) }

Goland 2020-10-26 PM 1885℃ 0条
golang中文字符编码转换

golang中文字符编码转换

golang处理中文时默认是utf8,当遇到其他如GBK字符是就会出现乱码,此处介绍golang 官方golang.org/x/text/encoding/simplifiedchinese包下的编码转换package main import "golang.org/x/text/encoding/simplifiedchinese" type Charset string const ( UTF8 = Charset("UTF-8") GB18030 = Charset("GB18030") ) fu...

Goland 2020-10-26 PM 1404℃ 0条