PHP Class think\Controller

Datei anzeigen Open project: top-think/framework Class Usage Examples

Protected Properties

Property Type Description
$batchValidate 是否批量验证
$beforeActionList array 前置操作方法列表
$failException 验证失败是否抛出异常
$request Request实例
$view 视图类实例

Public Methods

Method Description
__construct ( think\Request $request = null ) 架构函数

Protected Methods

Method Description
_initialize ( ) 初始化
assign ( mixed $name, mixed $value = '' ) : void 模板变量赋值
beforeAction ( string $method, array $options = [] ) 前置操作
display ( string $content = '', array $vars = [], array $replace = [], array $config = [] ) : mixed 渲染内容输出
engine ( array | string $engine ) : void 初始化模板引擎
fetch ( string $template = '', array $vars = [], array $replace = [], array $config = [] ) : mixed 加载模板输出
validate ( array $data, string | array $validate, array $message = [], boolean $batch = false, mixed $callback = null ) : array | string | true 验证数据
validateFailException ( boolean $fail = true ) 设置验证失败后是否抛出异常

Method Details

__construct() public method

架构函数
public __construct ( think\Request $request = null )
$request think\Request Request对象

_initialize() protected method

初始化
protected _initialize ( )

assign() protected method

模板变量赋值
protected assign ( mixed $name, mixed $value = '' ) : void
$name mixed 要显示的模板变量
$value mixed 变量的值
return void

beforeAction() protected method

前置操作
protected beforeAction ( string $method, array $options = [] )
$method string 前置操作方法名
$options array 调用参数 ['only'=>[...]] 或者['except'=>[...]]

display() protected method

渲染内容输出
protected display ( string $content = '', array $vars = [], array $replace = [], array $config = [] ) : mixed
$content string 模板内容
$vars array 模板输出变量
$replace array 替换内容
$config array 模板参数
return mixed

engine() protected method

初始化模板引擎
protected engine ( array | string $engine ) : void
$engine array | string 引擎参数
return void

fetch() protected method

加载模板输出
protected fetch ( string $template = '', array $vars = [], array $replace = [], array $config = [] ) : mixed
$template string 模板文件名
$vars array 模板输出变量
$replace array 模板替换
$config array 模板参数
return mixed

validate() protected method

验证数据
protected validate ( array $data, string | array $validate, array $message = [], boolean $batch = false, mixed $callback = null ) : array | string | true
$data array 数据
$validate string | array 验证器名或者验证规则数组
$message array 提示信息
$batch boolean 是否批量验证
$callback mixed 回调方法(闭包)
return array | string | true

validateFailException() protected method

设置验证失败后是否抛出异常
protected validateFailException ( boolean $fail = true )
$fail boolean 是否抛出异常

Property Details

$batchValidate protected_oe property

是否批量验证
protected $batchValidate

$beforeActionList protected_oe property

前置操作方法列表
protected array $beforeActionList
return array

$failException protected_oe property

验证失败是否抛出异常
protected $failException

$request protected_oe property

Request实例
protected $request

$view protected_oe property

视图类实例
protected $view