mirror of
https://github.com/unknwon/the-way-to-go_ZH_CN.git
synced 2025-08-12 03:34:15 +08:00
Update 15.4.md
This commit is contained in:
@@ -50,4 +50,10 @@ func main() {
|
||||
```
|
||||
注:当使用字符串常量表示html文本的时候,包含`<html><body></body></html>`对于让浏览器识别它收到了一个html非常重要。
|
||||
|
||||
更安全的做法是在处理器中使用`w.Header().Set("Content-Type", "text/html")`在写入返回之前将`header`的`content-type`设置为`text/html`
|
||||
|
||||
`content-type`会让浏览器认为它可以使用函数`http.DetectContentType([]byte(form))`来处理收到的数据
|
||||
|
||||
练习 15.6 [statistics.go]
|
||||
|
||||
编写一个网页程序,可以让用户输入一连串的数字,然后将它们打印出来,计算出这些数字的均值和中值,就像下边这张截图一样
|
||||
|
Reference in New Issue
Block a user