如有不对欢迎指正,相互学习,共同进步。
<强>补充:去创建文件带目录
我就废话不多说了,大家还是直接看代码吧~
//,create file with dir if dir is not 存在//,path is dir//,name is file 名字 func createFileWithDir(字符串,path name 字符串,content 字符串),{ ,os.MkdirAll(路径,os.ModePerm) ,文件,_ :=, os.OpenFile(时间+ path “/? +,名字,,os.O_RDWR | os.O_CREATE | os.O_TRUNC,, 0666) ,defer file.Close () ,file.WriteString(内容) }