Skip to content
Projects
Groups
Snippets
Help
Loading...
Sign in
Toggle navigation
B
beego
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Commits
Issue Boards
Open sidebar
go
beego
Commits
d2e0960b
Commit
d2e0960b
authored
May 08, 2013
by
astaxie
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fix the example error
parent
a851641f
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
3 additions
and
3 deletions
+3
-3
Quickstart.md
docs/zh/Quickstart.md
+3
-3
No files found.
docs/zh/Quickstart.md
View file @
d2e0960b
...
@@ -504,14 +504,14 @@ XML数据直接输出,设置`content-type`为`application/xml`:
...
@@ -504,14 +504,14 @@ XML数据直接输出,设置`content-type`为`application/xml`:
beego框架默认支持404、401、403、500、503这几种错误的处理。用户可以自定义相应的错误处理,例如下面重新定义404页面:
beego框架默认支持404、401、403、500、503这几种错误的处理。用户可以自定义相应的错误处理,例如下面重新定义404页面:
func page_not_found(rw http.ResponseWriter, r
*
http.Request){
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 :=make(map
[
string
]
interface{})
data
[
"content"
]
= "page not found"
data
[
"content"
]
= "page not found"
t.Execute(rw, data)
t.Execute(rw, data)
}
}
func main() {
func main() {
beego.Errorhandler("404",
PageNotFound)
beego.Errorhandler("404",
page_not_found)
beego.Router("/", &controllers.MainController{})
beego.Router("/", &controllers.MainController{})
beego.Run()
beego.Run()
}
}
...
@@ -521,7 +521,7 @@ beego框架默认支持404、401、403、500、503这几种错误的处理。用
...
@@ -521,7 +521,7 @@ beego框架默认支持404、401、403、500、503这几种错误的处理。用
beego更加人性化的还有一个设计就是支持用户自定义字符串错误类型处理函数,例如下面的代码,用户注册了一个数据库出错的处理页面:
beego更加人性化的还有一个设计就是支持用户自定义字符串错误类型处理函数,例如下面的代码,用户注册了一个数据库出错的处理页面:
func dbError(rw http.ResponseWriter, r
*
http.Request){
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 :=make(map
[
string
]
interface{})
data
[
"content"
]
= "database is now down"
data
[
"content"
]
= "database is now down"
t.Execute(rw, data)
t.Execute(rw, data)
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
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 comment