
golang
samete
这个作者很懒,什么都没留下…
展开
专栏收录文章
- 默认排序
- 最新发布
- 最早发布
- 最多阅读
- 最少阅读
-
一个下载图片的小程序
package mainimport ( "bytes" "fmt" "io" "io/ioutil" "net/http" "os" "time")func main() { fmt.Println(time.Now()) getFiles("http://www.baidu.com/img/", "270Gif_75f179cfd23e0afe31365b7e169原创 2015-06-01 10:44:50 · 1826 阅读 · 0 评论 -
golang web开发获取get、post、cookie参数
点击打开链接转载 2015-06-03 20:04:18 · 2620 阅读 · 0 评论 -
golang中x.(type)只能在switch中使用
例如:func MyPrintf(args ...interface{}) {for _, arg := range args {switch arg.(type) {case int:fmt.Println(arg, "is an int value.")case string:fmt.Println(arg, "is a string value.")case int64:原创 2015-06-14 19:44:06 · 6844 阅读 · 0 评论 -
golang中x.(type)只能用在switch中
例如:func MyPrintf(args ...interface{}) {for _, arg := range args {switch arg.(type) {case int:fmt.Println(arg, "is an int value.")case string:fmt.Println(arg, "is a string value.")case int64:原创 2015-06-14 19:46:29 · 854 阅读 · 0 评论 -
golang中的坑
package mainimport ( "fmt")func main() { t1 := []int32{1, 2, 3} fmt.Println(printSelf(t1)) fmt.Println(t1) fmt.Println("................................") t2 := &[]int32{1, 2, 3} fmt.Pri原创 2016-03-06 11:44:31 · 1351 阅读 · 0 评论 -
golan的template包中的eq函数的用法
{{define "header"}} {{.Index}} {{.Article}} {{.Favourite}} {{.Write}} {{.AboutMe}} {{if eq .Opt "登录"}} {{.Opt}} {{else}} {{.Opt}} {{end}} {{end}}原创 2016-06-04 21:17:05 · 2778 阅读 · 0 评论 -
golang的缓冲channel和无缓冲channel的区别
golang channel 有缓冲 与 无缓冲 是有重要区别的我之前天真的认为 有缓冲与无缓冲的区别 只是 无缓冲的 是 默认 缓冲 为1 的缓冲式其实是彻底错误的,无缓冲的与有缓冲channel有着重大差别那就是一个是同步的 一个是非同步的怎么说?比如c1:=make(chan int) 无缓冲c2:=make(chan int,1转载 2016-10-07 18:58:27 · 7389 阅读 · 0 评论 -
go判断两个字符串是否是是相互打乱的,也就是说它们有着相同的字符,但 是对应不同的顺序。
package mainimport ( "fmt" "strings" "unicode/utf8")func main() { fmt.Println(string([]rune("starting chat...")[2])) fmt.Println(string([]rune("你好,世界!")), []byte("你好,世界!")) fmt.Println("你好,原创 2017-01-13 14:35:56 · 1706 阅读 · 4 评论 -
golang获取并解析ajax请求参数(带数组)
前台代码:(category是数组)var data = { title: title, category: category.split(","), cancomment: cancomment, content: content, totalWords: totalWords }; $.ajax({ type: "POST", url:原创 2017-01-19 10:25:23 · 11700 阅读 · 0 评论