杭州--8

来源:互联网 发布:出名的网络翻唱歌手 编辑:程序博客网 时间:2024/04/29 14:56
group by 列名 :根据列名对表分组,一般会有另外一个被整合的列(如sum(price))
having 语意等于where,但where后面不能跟函数,此时可以用having ,例:having sum(price)>2000


1、引入包“html/template”可以使用t, _ := template.ParseFiles("login.gtpl")
      t.Execute(w, nil)     //如果是get请求,可以访问这个页面
2、在git下运行命令界面,在可执行文件目录下输入./gotest.exe可以执行文件


3、dos命令:taskkil /f /im qq.exe


4、修改main.go代码以后要在sublime里面进行build,不能直接在git里面go build。注:也可以修改以后直接ctrl+s保存,会自动重新编译。


简单的GoWeb框架:
1、在main函数里设置监听端口:http.ListenAndServe(":9090",nil),这个函数
的返回值为报错信息,可以用log.Fatal()将其输出
2、在main函数里设置路由:http.Handlefunc("/login",Login),注意“/”不能丢失,否则
会执行默认的hander
3、写Login函数,有几个注意点:
a.参数类型为(w http.ResponseWrite,r *http.Request)
b.这个函数里面fmt.Println()都是把内容输出在服务端界面,而不是客户端;
c.可以用r.Method()获取方法为post还是get
d.方法为get时,可以用fmt.Fprintln(w,"内容")将内容展示在页面,或者用
t,_ := template.ParseFile("login.gtpl"同目录下的一个文件)
t.Execute(t,nil)可以把页面内容展示在客户端
e.方法为post时,可以用fmt.Println("username:",r.Form["username"])将表单内容
输出在服务端
f.“r.Form”是一个切片
0 0