Skip to content
Toggle navigation
Toggle navigation
This project
Loading...
Sign in
张磊
/
FileStorageBeego
Go to a project
Toggle navigation
Toggle navigation pinning
Projects
Groups
Snippets
Help
Project
Activity
Repository
Pipelines
Graphs
Issues
0
Merge Requests
0
Wiki
Network
Create a new issue
Builds
Commits
Issue Boards
Files
Commits
Network
Compare
Branches
Tags
d2e0960b
authored
2013-05-08 13:15:35 +0800
by
astaxie
Browse Files
Options
Browse Files
Tag
Download
Email Patches
Plain Diff
fix the example error
1 parent
a851641f
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
3 additions
and
3 deletions
docs/zh/Quickstart.md
docs/zh/Quickstart.md
View file @
d2e0960
...
...
@@ -504,14 +504,14 @@ XML数据直接输出,设置`content-type`为`application/xml`:
beego框架默认支持404、401、403、500、503这几种错误的处理。用户可以自定义相应的错误处理,例如下面重新定义404页面:
func page_not_found(rw http.ResponseWriter, r
*
http.Request){
t
:= template.New("beegoerrortemp").ParseFiles(beego.ViewsPath+"404.html")
t
,_:= template.New("beegoerrortemp").ParseFiles(beego.ViewsPath+"/404.html")
data :=make(map
[
string
]
interface{})
data
[
"content"
]
= "page not found"
t.Execute(rw, data)
}
func main() {
beego.Errorhandler("404",
PageNotFound)
beego.Errorhandler("404",
page_not_found)
beego.Router("/", &controllers.MainController{})
beego.Run()
}
...
...
@@ -521,7 +521,7 @@ beego框架默认支持404、401、403、500、503这几种错误的处理。用
beego更加人性化的还有一个设计就是支持用户自定义字符串错误类型处理函数,例如下面的代码,用户注册了一个数据库出错的处理页面:
func dbError(rw http.ResponseWriter, r
*
http.Request){
t
:= template.New("beegoerrortemp").ParseFiles(beego.ViewsPath+"dberror.html")
t
,_:= template.New("beegoerrortemp").ParseFiles(beego.ViewsPath+"/dberror.html")
data :=make(map
[
string
]
interface{})
data
[
"content"
]
= "database is now down"
t.Execute(rw, data)
...
...
Write
Preview
Styling with
Markdown
is supported
Attach a file
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to post a comment