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
0172c6c1
authored
2013-04-21 10:55:09 +0800
by
astaxie
Browse Files
Options
Browse Files
Tag
Download
Email Patches
Plain Diff
update docs
1 parent
57d19b44
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
9 additions
and
1 deletions
docs/zh/Quickstart.md
docs/zh/Quickstart.md
View file @
0172c6c
...
...
@@ -150,7 +150,7 @@
-
beego.Router("/news/:all", &controllers.RController{})
全匹配方式 //匹配 /news/path/to/123.html :all= path/to/123.html
-
beego.Router(
"/user/:username(
[
\w
]
+)"
, &controllers.RController{})
-
beego.Router(
\`
/user/:username(
[
\w
]
+)
\`
, &controllers.RController{})
正则字符串匹配 //匹配 /user/astaxie :username = astaxie
-
beego.Router("/download/
*.*
", &controllers.RController{})
...
...
@@ -164,6 +164,14 @@
-
beego.Router("/:hi:string", &controllers.RController{})
string类型设置方式 //匹配 :hi为string类型。框架帮你实现了正则(
[
\w
]
+)
如何在Controller中获取,上面的变量可以通过如下方式获取
this.Ctx.Params
[
":id"
]
this.Ctx.Params
[
":username"
]
this.Ctx.Params
[
":splat"
]
this.Ctx.Params
[
":path"
]
this.Ctx.Params
[
":ext"
]
## 静态文件
Go语言内部其实已经提供了
`http.ServeFile`
,通过这个函数可以实现静态文件的服务。beego针对这个功能进行了一层封装,通过下面的方式进行静态文件注册:
...
...
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