golang httpserver如果采用 fmt.Fprintf(w, result)来输出json数据时,若json数据包含%号,则会出现问题。
 
输出结果里面会包含(MISSING)字样,造成json格式错误。

把输出函数替换为w.Write即可。


func Action(w http.ResponseWriter, r *http.Request) { var result string //....................... // fmt.Fprintf(w, result) w.Write([]byte(result)) }

 

相关文章:

  • 2022-02-10
  • 2021-07-11
  • 2021-10-18
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
猜你喜欢
  • 2021-09-25
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2022-02-24
  • 2021-07-15
相关资源
相似解决方案