abort() abort(int|\Response $code, string $message = '', array $header = []) : mixed 抛出HTTP异常 Parameters int|\Response $code 状态码 或者 Response对象实例 string $message 错误信息 array $header 参数 Returns mixed —
app() app(string $name = '', array $args = [], bool $newInstance = false) : object|\App 快速获取容器中的实例 支持依赖注入 Parameters string $name 类名或标识 默认获取当前应用实例 array $args 参数 bool $newInstance 是否每次创建新的实例 Returns object|\App —
bind() bind(string|array $abstract, mixed $concrete = null) : \Container 绑定一个类到容器 Parameters string|array $abstract 类标识、接口(支持批量绑定) mixed $concrete 要绑定的类、闭包或者实例 Returns \Container —
cache() cache(string $name = null, mixed $value = '', mixed $options = null, string $tag = null) : mixed 缓存管理 Parameters string $name 缓存名称 mixed $value 缓存值 mixed $options 缓存参数 string $tag 缓存标签 Returns mixed —
config() config(string|array $name = '', mixed $value = null) : mixed 获取和设置配置参数 Parameters string|array $name 参数名 mixed $value 参数值 Returns mixed —
cookie() cookie(string $name, mixed $value = '', mixed $option = null) : mixed Cookie管理 Parameters string $name cookie名称 mixed $value cookie值 mixed $option 参数 Returns mixed —
download() download(string $filename, string $name = '', bool $content = false, int $expire = 180) : \think\response\File 获取\think\response\Download对象实例 Parameters string $filename 要下载的文件 string $name 显示文件名 bool $content 是否为内容 int $expire 有效期(秒) Returns \think\response\File —
env() env(string $name = null, string $default = null) : mixed 获取环境变量值 Parameters string $name 环境变量名(支持二级 .号分割) string $default 默认值 Returns mixed —
event() event(mixed $event, mixed $args = null) : mixed 触发事件 Parameters mixed $event 事件名(或者类名) mixed $args 参数 Returns mixed —
halt() halt(mixed ...$vars) : mixed 调试变量并且中断输出 Parameters mixed $vars variadic 调试变量或者信息 Returns mixed —
input() input(string $key = '', mixed $default = null, string $filter = '') : mixed 获取输入数据 支持默认值和过滤 Parameters string $key 获取的变量名 mixed $default 默认值 string $filter 过滤方法 Returns mixed —
invoke() invoke(mixed $call, array $args = []) : mixed 调用反射实例化对象或者执行方法 支持依赖注入 Parameters mixed $call 类名或者callable array $args 参数 Returns mixed —
json() json(mixed $data = [], int $code = 200, array $header = [], array $options = []) : \think\response\Json 获取\think\response\Json对象实例 Parameters mixed $data 返回的数据 int $code 状态码 array $header 头部 array $options 参数 Returns \think\response\Json —
jsonp() jsonp(mixed $data = [], int $code = 200, array $header = [], array $options = []) : \think\response\Jsonp 获取\think\response\Jsonp对象实例 Parameters mixed $data 返回的数据 int $code 状态码 array $header 头部 array $options 参数 Returns \think\response\Jsonp —
lang() lang(string $name, array $vars = [], string $lang = '') : mixed 获取语言变量值 Parameters string $name 语言变量名 array $vars 动态变量值 string $lang 语言 Returns mixed —
parse_name() parse_name(string $name, int $type, bool $ucfirst = true) : string 字符串命名风格转换 type 0 将Java风格转换为C的风格 1 将C风格转换为Java的风格 Parameters string $name 字符串 int $type 转换类型 bool $ucfirst 首字母是否大写(驼峰规则) Returns string —
redirect() redirect(string $url = '', int $code = 302) : \think\response\Redirect 获取\think\response\Redirect对象实例 Parameters string $url 重定向地址 int $code 状态码 Returns \think\response\Redirect —
response() response(mixed $data = '', int|string $code = 200, array $header = [], string $type = 'html') : \Response 创建普通 Response 对象实例 Parameters mixed $data 输出数据 int|string $code 状态码 array $header 头信息 string $type Returns \Response —
session() session(string $name = '', mixed $value = '') : mixed Session管理 Parameters string $name session名称 mixed $value session值 Returns mixed —
token() token(string $name = '__token__', mixed $type = 'md5') : string 获取Token令牌 Parameters string $name 令牌名称 mixed $type 令牌生成方法 Returns string —
token_field() token_field(string $name = '__token__', mixed $type = 'md5') : string 生成令牌隐藏表单 Parameters string $name 令牌名称 mixed $type 令牌生成方法 Returns string —
token_meta() token_meta(string $name = '__token__', mixed $type = 'md5') : string 生成令牌meta Parameters string $name 令牌名称 mixed $type 令牌生成方法 Returns string —
trace() trace(mixed $log = '[think]', string $level = 'log') : array|void 记录日志信息 Parameters mixed $log log信息 支持字符串和数组 string $level 日志级别 Returns array|void —
url() url(string $url = '', array $vars = [], bool|string $suffix = true, bool|string $domain = false) : \UrlBuild Url生成 Parameters string $url 路由地址 array $vars 变量 bool|string $suffix 生成的URL后缀 bool|string $domain 域名 Returns \UrlBuild —
validate() validate(string|array $validate = '', array $message = [], bool $batch = false, bool $failException = true) : \Validate 生成验证对象 Parameters string|array $validate 验证器类名或者验证规则数组 array $message 错误提示信息 bool $batch 是否批量验证 bool $failException 是否抛出异常 Returns \Validate —
view() view(string $template = '', array $vars = [], int $code = 200, callable $filter = null) : \think\response\View 渲染模板输出 Parameters string $template 模板文件 array $vars 模板变量 int $code 状态码 callable $filter 内容过滤 Returns \think\response\View —
display() display(string $content, array $vars = [], int $code = 200, callable $filter = null) : \think\response\View 渲染模板输出 Parameters string $content 渲染内容 array $vars 模板变量 int $code 状态码 callable $filter 内容过滤 Returns \think\response\View —
xml() xml(mixed $data = [], int $code = 200, array $header = [], array $options = []) : \think\response\Xml 获取\think\response\Xml对象实例 Parameters mixed $data 返回的数据 int $code 状态码 array $header 头部 array $options 参数 Returns \think\response\Xml —
config_path() config_path(string $path = '') : string 获取应用配置目录 Parameters string $path Returns string —
public_path() public_path(string $path = '') : string 获取web根目录 Parameters string $path Returns string —
runtime_path() runtime_path(string $path = '') : string 获取应用运行时目录 Parameters string $path Returns string —