controllers

package
v0.0.0-...-2926792 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jul 29, 2019 License: Apache-2.0 Imports: 4 Imported by: 0

Documentation

Overview

*

  • 文件上传 配置文件设置文件大小: beego.MaxMemory = 1<<22
  • @author qinxuewu
  • @create 19/5/31下午10:08
  • @since 1.0.0

*

  • session 控制
  • @author qinxuewu
  • @create 19/6/1下午6:24
  • @since 1.0.0

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type CMSController

type CMSController struct {
	beego.Controller
}

CMS API

func (*CMSController) AllBlock

func (this *CMSController) AllBlock()

@router /all/:key [get]

func (*CMSController) Bind

func (this *CMSController) Bind()

@router /bind/:key [get]

func (*CMSController) StaticBlock

func (this *CMSController) StaticBlock()

@router /staticblock/:key [get]

func (*CMSController) URLMapping

func (c *CMSController) URLMapping()

type ErrorController

type ErrorController struct {
	beego.Controller
}

func (*ErrorController) Error404

func (c *ErrorController) Error404()

func (*ErrorController) Error501

func (c *ErrorController) Error501()

func (*ErrorController) ErrorDb

func (c *ErrorController) ErrorDb()

type FileController

type FileController struct {
	beego.Controller
}

func (*FileController) Get

func (c *FileController) Get()

func (*FileController) Uplod

func (c *FileController) Uplod()

* Beego 提供了两个很方便的方法来处理文件上传:

GetFile(key string) (multipart.File, *multipart.FileHeader, error)
该方法主要用于用户读取表单中的文件名 the_file,然后返回相应的信息,用户根据这些变量来处理文件上传:过滤、保存文件等。

SaveToFile(fromfile, tofile string) error
该方法是在 GetFile 的基础上实现了快速保存的功能 fromfile 是提交时候的 html 表单中的 name

type HtmlController

type HtmlController struct {
	beego.Controller
}

func (*HtmlController) Get

func (c *HtmlController) Get()

type JsonController

type JsonController struct {
	beego.Controller
}

func (*JsonController) Outjson

func (c *JsonController) Outjson()

输出json数据 http://localhost:8080/object/outjson

func (*JsonController) Outjsonp

func (c *JsonController) Outjsonp()

jsonp调用 http://localhost:8080/object/outjsonp

type MainController

type MainController struct {
	beego.Controller
}

func (*MainController) Get

func (c *MainController) Get()

如果开启了 XSRF,那么 beego 的 Web 应用将对所有用户设置一个 _xsrf 的 cookie 值(默认过期 1 小时), 如果 POST PUT DELET 请求中没有这个 cookie 值,那么这个请求会被直接拒绝 。如果你开启了这个机制,那么在所有被提交的表单中,你都需要加上一个域来提供这个值。你可以通过在模板中使用 专门的函数 XSRFFormHTML()

func (*MainController) Post

func (c *MainController) Post()

type ObjectController

type ObjectController struct {
	beego.Controller
}

func (*ObjectController) Blog

func (c *ObjectController) Blog()

*

	当访问: http://localhost:8080/object/blog/2013/09/12
  除了前缀两个 /:controller/:method 的匹配之外,剩下的 url beego 会帮你自动化解析为参数,保存在 this.Ctx.Input.Params 当中

func (*ObjectController) Login

func (c *ObjectController) Login()

func (*ObjectController) Logout

func (c *ObjectController) Logout()

type RestController

type RestController struct {
	beego.Controller
}

func (*RestController) ApiFunc

func (c *RestController) ApiFunc()

func (*RestController) CreateFood

func (c *RestController) CreateFood()

func (*RestController) DeleteFood

func (c *RestController) DeleteFood()

func (*RestController) GetFunc

func (c *RestController) GetFunc()

func (*RestController) ListFood

func (c *RestController) ListFood()

func (*RestController) PostFunc

func (c *RestController) PostFunc()

func (*RestController) UpdateFood

func (c *RestController) UpdateFood()

type Server

type Server struct {
	ServerName string `json:"serverName"`
	ServerIP   string `json:"serverIP"`
}

type SessionController

type SessionController struct {
	beego.Controller
}

func (*SessionController) Get

func (c *SessionController) Get()

type SinatraController

type SinatraController struct {
	beego.Controller
}

func (*SinatraController) FindId

func (c *SinatraController) FindId()

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL