|
12345678910111213141516171819202122 |
- package zhios_order_relate_utils
-
- import (
- "os"
- "path"
- "strings"
- "time"
- )
-
- // 获取文件后缀
- func FileExt(fname string) string {
- return strings.ToLower(strings.TrimLeft(path.Ext(fname), "."))
- }
-
- func FilePutContents(fileName string, content string) {
- fd, _ := os.OpenFile("./tmp/"+fileName+".logs", os.O_RDWR|os.O_CREATE|os.O_APPEND, 0644)
- fd_time := time.Now().Format("2006-01-02 15:04:05")
- fd_content := strings.Join([]string{"[", fd_time, "] ", content, "\n"}, "")
- buf := []byte(fd_content)
- fd.Write(buf)
- fd.Close()
- }
|