Properties

$deny

$deny : 

Type

$allow

$allow : 

Type

$view

$view : \Think\view

视图实例对象

Type

\Think\view

$config

$config : \Think\config

控制器参数

Type

\Think\config

Methods

getMenus()

getMenus(  $controller = CONTROLLER_NAME) 

获取控制器菜单数组,二级菜单元素位于一级菜单的'_child'元素中

Parameters

$controller

recordList()

recordList(array  $records) 

数据集分页

Parameters

array $records

传入的数据集

tableList()

tableList(array  $list, array  $thead) 

通用表格列表

Parameters

array $list

select 数据集

array $thead

表头配置数组

__construct()

__construct() 

架构函数 取得模板对象实例

__set()

__set(  $name,   $value) 

Parameters

$name
$value

get()

get(string  $name = '') : mixed

取得模板显示变量的值

Parameters

string $name

模板显示变量

Returns

mixed

__get()

__get(  $name) 

Parameters

$name

__isset()

__isset(string  $name) : boolean

检测模板变量的值

Parameters

string $name

名称

Returns

boolean

__call()

__call(string  $method, array  $args) : mixed

魔术方法 有不存在的操作的时候执行

Parameters

string $method

方法名

array $args

参数

Returns

mixed

__destruct()

__destruct() 

析构方法

index()

index() 

用户管理首页

updateNickname()

updateNickname() 

修改昵称初始化

submitNickname()

submitNickname() 

修改昵称提交

updatePassword()

updatePassword() 

修改密码初始化

submitPassword()

submitPassword() 

修改密码提交

action()

action() 

用户行为列表

addAction()

addAction() 

新增行为

editAction()

editAction() 

编辑行为

saveAction()

saveAction() 

更新行为

setStatus()

setStatus() 

设置一条或者多条数据的状态

changeStatus()

changeStatus(  $method = null) 

会员状态修改

Parameters

$method

add()

add(  $username = '',   $password = '',   $repassword = '',   $email = '') 

Parameters

$username
$password
$repassword
$email

_initialize()

_initialize() 

后台控制器初始化

checkRule()

checkRule(string  $rule,   $type = \Admin\Model\AuthRuleModel::RULE_URL, string  $mode = 'url') : boolean

权限检测

Parameters

string $rule

检测的规则

$type
string $mode

check模式

Returns

boolean

checkDynamic()

checkDynamic() : boolean|null

检测是否是需要动态判断的权限

Returns

boolean|null —

返回true则表示当前访问有权限 返回false则表示当前访问无权限 返回null,则会进入checkRule根据节点授权判断权限

accessControl()

accessControl() : boolean|null

action访问控制,在 **登陆成功** 后执行的第一项权限检测任务

Returns

boolean|null —

返回值必须使用 === 进行判断

返回 false, 不允许任何人访问(超管除外) 返回 true, 允许任何管理员访问,无需执行节点权限检测 返回 null, 需要继续执行节点权限检测决定是否允许访问

editRow()

editRow(string  $model, array  $data, array  $where, array  $msg) 

对数据表中的单行或多行记录执行修改 GET参数id为数字或逗号分隔的数字

Parameters

string $model

模型名称,供M函数使用的参数

array $data

修改的数据

array $where

查询时的where()方法的参数

array $msg

执行正确和错误的消息 array('success'=>'','error'=>'', 'url'=>'','ajax'=>false) url为跳转页面,ajax是否ajax方式(数字则为倒数计时秒数)

forbid()

forbid(string  $model, array  $where = array(), array  $msg = array('success' => '状态禁用成功!', 'error' => '状态禁用失败!')) 

禁用条目

Parameters

string $model

模型名称,供D函数使用的参数

array $where

查询时的 where()方法的参数

array $msg

执行正确和错误的消息,可以设置四个元素 array('success'=>'','error'=>'', 'url'=>'','ajax'=>false) url为跳转页面,ajax是否ajax方式(数字则为倒数计时秒数)

resume()

resume(string  $model, array  $where = array(), array  $msg = array('success' => '状态恢复成功!', 'error' => '状态恢复失败!')) 

恢复条目

Parameters

string $model

模型名称,供D函数使用的参数

array $where

查询时的where()方法的参数

array $msg

执行正确和错误的消息 array('success'=>'','error'=>'', 'url'=>'','ajax'=>false) url为跳转页面,ajax是否ajax方式(数字则为倒数计时秒数)

restore()

restore(string  $model, array  $where = array(), array  $msg = array('success' => '状态还原成功!', 'error' => '状态还原失败!')) 

还原条目

Parameters

string $model

模型名称,供D函数使用的参数

array $where

查询时的where()方法的参数

array $msg

执行正确和错误的消息 array('success'=>'','error'=>'', 'url'=>'','ajax'=>false) url为跳转页面,ajax是否ajax方式(数字则为倒数计时秒数)

delete()

delete(string  $model, array  $where = array(), array  $msg = array('success' => '删除成功!', 'error' => '删除失败!')) 

条目假删除

Parameters

string $model

模型名称,供D函数使用的参数

array $where

查询时的where()方法的参数

array $msg

执行正确和错误的消息 array('success'=>'','error'=>'', 'url'=>'','ajax'=>false) url为跳转页面,ajax是否ajax方式(数字则为倒数计时秒数)

getDeny()

getDeny(string  $controller = CONTROLLER_NAME) 

获取控制器中允许禁止任何人(超管除外)通过url访问的方法

Parameters

string $controller

控制器类名(不含命名空间)

getAllow()

getAllow(string  $controller = CONTROLLER_NAME) 

获取控制器中允许所有管理员通过url访问的方法

Parameters

string $controller

控制器类名(不含命名空间)

getVal()

getVal(string  $val) 

供子类读取基类中的私有属性

Parameters

string $val

属性名

returnNodes()

returnNodes(boolean  $tree = true) 

返回后台节点数据

Parameters

boolean $tree

是否返回多维数组结构(生成菜单时用到),为false返回一维数组(生成权限节点时用到)

lists()

lists(\Admin\Controller\sting|\Admin\Controller\Model  $model, array  $where = array(), array|string  $order = '', array  $base = array('status' => array('egt', 0)), boolean  $field = true) : array|false

通用分页列表数据集获取方法,获取的数据集主要供tableList()方法用来生成表格列表

可以通过url参数传递where条件,例如: index.html?name=asdfasdfasdfddds 可以通过url空值排序字段和方式,例如: index.html?_field=id&_order=asc 可以通过url参数r指定每页数据条数,例如: index.html?r=5

Parameters

\Admin\Controller\sting|\Admin\Controller\Model $model

模型名或模型实例

array $where

where查询条件(优先级: $where>$_REQUEST>模型设定)

array|string $order

排序条件,传入null时使用sql默认排序或模型属性(优先级最高); 请求参数中如果指定了_order和_field则据此排序(优先级第二); 否则使用$order参数(如果$order参数,且模型也没有设定过order,则取主键降序);

array $base

基本的查询条件

boolean $field

单表模型用不到该参数,要用在多表join时为field()方法指定参数

Returns

array|false —

返回数据集

display()

display(string  $templateFile = '', string  $charset = '', string  $contentType = '', string  $content = '', string  $prefix = '') : void

模板显示 调用内置的模板引擎显示方法,

Parameters

string $templateFile

指定要调用的模板文件 默认为空 由系统自动定位模板文件

string $charset

输出编码

string $contentType

输出类型

string $content

输出内容

string $prefix

模板缓存前缀

show()

show(string  $content, string  $charset = '', string  $contentType = '', string  $prefix = '') : mixed

输出内容文本可以包括Html 并支持内容解析

Parameters

string $content

输出内容

string $charset

模板输出字符集

string $contentType

输出类型

string $prefix

模板缓存前缀

Returns

mixed

fetch()

fetch(string  $templateFile = '', string  $content = '', string  $prefix = '') : string

获取输出页面内容 调用内置的模板引擎fetch方法,

Parameters

string $templateFile

指定要调用的模板文件 默认为空 由系统自动定位模板文件

string $content

模板输出内容

string $prefix

模板缓存前缀*

Returns

string

buildHtml()

buildHtml(  $htmlfile = '',   $htmlpath = '', string  $templateFile = '') : string

创建静态页面

Parameters

$htmlfile
$htmlpath
string $templateFile

指定要调用的模板文件 默认为空 由系统自动定位模板文件

Returns

string

theme()

theme(string  $theme) : \Think\Action

模板主题设置

Parameters

string $theme

模版主题

Returns

\Think\Action

assign()

assign(mixed  $name, mixed  $value = '') : \Think\Action

模板变量赋值

Parameters

mixed $name

要显示的模板变量

mixed $value

变量的值

Returns

\Think\Action

error()

error(string  $message = '', string  $jumpUrl = '', mixed  $ajax = false) : void

操作错误跳转的快捷方法

Parameters

string $message

错误信息

string $jumpUrl

页面跳转地址

mixed $ajax

是否为Ajax方式 当数字时指定跳转时间

success()

success(string  $message = '', string  $jumpUrl = '', mixed  $ajax = false) : void

操作成功跳转的快捷方法

Parameters

string $message

提示信息

string $jumpUrl

页面跳转地址

mixed $ajax

是否为Ajax方式 当数字时指定跳转时间

ajaxReturn()

ajaxReturn(mixed  $data, String  $type = '') : void

Ajax方式返回数据到客户端

Parameters

mixed $data

要返回的数据

String $type

AJAX返回数据格式

redirect()

redirect(string  $url, array  $params = array(), integer  $delay, string  $msg = '') : void

Action跳转(URL重定向) 支持指定模块和延时跳转

Parameters

string $url

跳转的URL表达式

array $params

其它URL参数

integer $delay

延时跳转的时间 单位为秒

string $msg

跳转提示信息

mobileApi()

mobileApi(  $data, string  $info = '', integer  $status = 1, string  $type = 'JSON', integer  $isUnicode) 

统一API输出

Parameters

$data
string $info
integer $status
string $type
integer $isUnicode

dispatchJump()

dispatchJump(string  $message, Boolean  $status = 1, string  $jumpUrl = '', mixed  $ajax = false) : void

默认跳转操作 支持错误导向和正确跳转 调用模板显示 默认为public目录下面的success页面 提示页面为可配置 支持模板标签

Parameters

string $message

提示信息

Boolean $status

状态

string $jumpUrl

页面跳转地址

mixed $ajax

是否为Ajax方式 当数字时指定跳转时间

showRegError()

showRegError(integer  $code) : string

获取用户注册错误信息

Parameters

integer $code

错误编码

Returns

string —

错误信息