张大猫 3年前

修改理由:

出现了一个文章里没有的情况

详细描述:

特意贴上了自己的处理步骤,希望能帮到更多的人

相关信息:


此投稿状态为 标记为已读

标题修改:

+ 创建博文

内容修改:

红色背景 为原始内容

绿色背景 为新增或者修改的内容

OldNewDifferences
135135```
136136
137137保存后将编译成功,浏览器访问 http://localhost:3000/articles/create ,可见:
 138此时,会出现另一个错误:  
138139
 140![创建博文](https://cdn.learnku.com/uploads/images/202201/04/33757/0ydWG8Aoyu.png!large)  
 141原因是:表单提交地址使用了一个不存在的路由:  
 142storeURL, _ := router.Get("articles.store").URL()  
 143所以需要补一个articles.store的路由和函数:  
 144```  
 145router.HandleFunc("/articles/store", articlesStoreHandler).Methods("GET").Name("articles.store")  
 146```  
 147```  
 148func articlesStoreHandler(w http.ResponseWriter, r *http.Request) {  
139149
 150fmt.Fprint(w, "保存文章")  
 151  
 152}  
 153```  
 154保存后将编译成功,浏览器访问 http://localhost:3000/articles/create ,可见:  
140155![创建博文](https://cdn.learnku.com/uploads/images/202009/08/1/JBH5wcZL5k.png!large)
141156
142157浏览器上右键,查看源码: