mirror of
https://gitee.com/fastadminnet/framework.git
synced 2026-07-11 08:56:19 +08:00
注释规范
This commit is contained in:
@@ -29,8 +29,8 @@ class Cache
|
||||
/**
|
||||
* 连接缓存
|
||||
* @access public
|
||||
* @param array $options 配置数组
|
||||
* @param bool|string $name 缓存连接标识 true 强制重新连接
|
||||
* @param array $options 配置数组
|
||||
* @param bool|string $name 缓存连接标识 true 强制重新连接
|
||||
* @return object
|
||||
*/
|
||||
public static function connect(array $options = [], $name = false)
|
||||
@@ -84,9 +84,9 @@ class Cache
|
||||
/**
|
||||
* 写入缓存
|
||||
* @access public
|
||||
* @param string $name 缓存标识
|
||||
* @param mixed $value 存储数据
|
||||
* @param int|null $expire 有效时间 0为永久
|
||||
* @param string $name 缓存标识
|
||||
* @param mixed $value 存储数据
|
||||
* @param int|null $expire 有效时间 0为永久
|
||||
* @return boolean
|
||||
*/
|
||||
public static function set($name, $value, $expire = null)
|
||||
@@ -99,7 +99,7 @@ class Cache
|
||||
/**
|
||||
* 删除缓存
|
||||
* @access public
|
||||
* @param string $name 缓存标识
|
||||
* @param string $name 缓存标识
|
||||
* @return boolean
|
||||
*/
|
||||
public static function rm($name)
|
||||
|
||||
@@ -31,10 +31,10 @@ class Config
|
||||
|
||||
/**
|
||||
* 解析配置文件或内容
|
||||
* @param string $config 配置文件路径或内容
|
||||
* @param string $type 配置解析类型
|
||||
* @param string $name 配置名(如设置即表示二级配置)
|
||||
* @param string $range 作用域
|
||||
* @param string $config 配置文件路径或内容
|
||||
* @param string $type 配置解析类型
|
||||
* @param string $name 配置名(如设置即表示二级配置)
|
||||
* @param string $range 作用域
|
||||
*/
|
||||
public static function parse($config, $type = '', $name = '', $range = '')
|
||||
{
|
||||
@@ -48,9 +48,9 @@ class Config
|
||||
|
||||
/**
|
||||
* 加载配置文件(PHP格式)
|
||||
* @param string $file 配置文件名
|
||||
* @param string $name 配置名(如设置即表示二级配置)
|
||||
* @param string $range 作用域
|
||||
* @param string $file 配置文件名
|
||||
* @param string $name 配置名(如设置即表示二级配置)
|
||||
* @param string $range 作用域
|
||||
* @return mixed
|
||||
*/
|
||||
public static function load($file, $name = '', $range = '')
|
||||
@@ -73,8 +73,8 @@ class Config
|
||||
|
||||
/**
|
||||
* 检测配置是否存在
|
||||
* @param string $name 配置参数名(支持二级配置 .号分割)
|
||||
* @param string $range 作用域
|
||||
* @param string $name 配置参数名(支持二级配置 .号分割)
|
||||
* @param string $range 作用域
|
||||
* @return bool
|
||||
*/
|
||||
public static function has($name, $range = '')
|
||||
@@ -102,8 +102,8 @@ class Config
|
||||
|
||||
/**
|
||||
* 获取配置参数 为空则获取所有配置
|
||||
* @param string $name 配置参数名(支持二级配置 .号分割)
|
||||
* @param string $range 作用域
|
||||
* @param string $name 配置参数名(支持二级配置 .号分割)
|
||||
* @param string $range 作用域
|
||||
* @return mixed
|
||||
*/
|
||||
public static function get($name = null, $range = '')
|
||||
@@ -136,9 +136,9 @@ class Config
|
||||
|
||||
/**
|
||||
* 设置配置参数 name为数组则为批量设置
|
||||
* @param string|array $name 配置参数名(支持二级配置 .号分割)
|
||||
* @param mixed $value 配置值
|
||||
* @param string $range 作用域
|
||||
* @param string|array $name 配置参数名(支持二级配置 .号分割)
|
||||
* @param mixed $value 配置值
|
||||
* @param string $range 作用域
|
||||
* @return mixed
|
||||
*/
|
||||
public static function set($name, $value = null, $range = '')
|
||||
|
||||
@@ -98,10 +98,10 @@ class Controller
|
||||
/**
|
||||
* 加载模板输出
|
||||
* @access protected
|
||||
* @param string $template 模板文件名
|
||||
* @param array $vars 模板输出变量
|
||||
* @param array $replace 模板替换
|
||||
* @param array $config 模板参数
|
||||
* @param string $template 模板文件名
|
||||
* @param array $vars 模板输出变量
|
||||
* @param array $replace 模板替换
|
||||
* @param array $config 模板参数
|
||||
* @return mixed
|
||||
*/
|
||||
protected function fetch($template = '', $vars = [], $replace = [], $config = [])
|
||||
@@ -112,10 +112,10 @@ class Controller
|
||||
/**
|
||||
* 渲染内容输出
|
||||
* @access protected
|
||||
* @param string $content 模板内容
|
||||
* @param array $vars 模板输出变量
|
||||
* @param array $replace 替换内容
|
||||
* @param array $config 模板参数
|
||||
* @param string $content 模板内容
|
||||
* @param array $vars 模板输出变量
|
||||
* @param array $replace 替换内容
|
||||
* @param array $config 模板参数
|
||||
* @return mixed
|
||||
*/
|
||||
protected function display($content = '', $vars = [], $replace = [], $config = [])
|
||||
@@ -126,8 +126,8 @@ class Controller
|
||||
/**
|
||||
* 模板变量赋值
|
||||
* @access protected
|
||||
* @param mixed $name 要显示的模板变量
|
||||
* @param mixed $value 变量的值
|
||||
* @param mixed $name 要显示的模板变量
|
||||
* @param mixed $value 变量的值
|
||||
* @return void
|
||||
*/
|
||||
protected function assign($name, $value = '')
|
||||
@@ -161,11 +161,11 @@ class Controller
|
||||
/**
|
||||
* 验证数据
|
||||
* @access protected
|
||||
* @param array $data 数据
|
||||
* @param string|array $validate 验证器名或者验证规则数组
|
||||
* @param array $message 提示信息
|
||||
* @param bool $batch 是否批量验证
|
||||
* @param mixed $callback 回调方法(闭包)
|
||||
* @param array $data 数据
|
||||
* @param string|array $validate 验证器名或者验证规则数组
|
||||
* @param array $message 提示信息
|
||||
* @param bool $batch 是否批量验证
|
||||
* @param mixed $callback 回调方法(闭包)
|
||||
* @return true|string|array
|
||||
*/
|
||||
protected function validate($data, $validate, $message = [], $batch = false, $callback = null)
|
||||
|
||||
@@ -97,8 +97,8 @@ class Cookie
|
||||
|
||||
/**
|
||||
* 判断Cookie数据
|
||||
* @param string $name cookie名称
|
||||
* @param string|null $prefix cookie前缀
|
||||
* @param string $name cookie名称
|
||||
* @param string|null $prefix cookie前缀
|
||||
* @return bool
|
||||
*/
|
||||
public static function has($name, $prefix = null)
|
||||
@@ -110,8 +110,8 @@ class Cookie
|
||||
|
||||
/**
|
||||
* Cookie获取
|
||||
* @param string $name cookie名称
|
||||
* @param string|null $prefix cookie前缀
|
||||
* @param string $name cookie名称
|
||||
* @param string|null $prefix cookie前缀
|
||||
* @return mixed
|
||||
*/
|
||||
public static function get($name, $prefix = null)
|
||||
@@ -133,8 +133,8 @@ class Cookie
|
||||
|
||||
/**
|
||||
* Cookie删除
|
||||
* @param string $name cookie名称
|
||||
* @param string|null $prefix cookie前缀
|
||||
* @param string $name cookie名称
|
||||
* @param string|null $prefix cookie前缀
|
||||
* @return mixed
|
||||
*/
|
||||
public static function delete($name, $prefix = null)
|
||||
|
||||
@@ -51,8 +51,8 @@ class Db
|
||||
* 数据库初始化 并取得数据库类实例
|
||||
* @static
|
||||
* @access public
|
||||
* @param mixed $config 连接配置
|
||||
* @param bool|string $name 连接标识 true 强制重新连接
|
||||
* @param mixed $config 连接配置
|
||||
* @param bool|string $name 连接标识 true 强制重新连接
|
||||
* @return \think\db\Connection
|
||||
* @throws Exception
|
||||
*/
|
||||
|
||||
@@ -20,8 +20,8 @@ class Debug
|
||||
|
||||
/**
|
||||
* 记录时间(微秒)和内存使用情况
|
||||
* @param string $name 标记位置
|
||||
* @param mixed $value 标记值 留空则取当前 time 表示仅记录时间 否则同时记录时间和内存
|
||||
* @param string $name 标记位置
|
||||
* @param mixed $value 标记值 留空则取当前 time 表示仅记录时间 否则同时记录时间和内存
|
||||
* @return mixed
|
||||
*/
|
||||
public static function remark($name, $value = '')
|
||||
@@ -36,9 +36,9 @@ class Debug
|
||||
|
||||
/**
|
||||
* 统计某个区间的时间(微秒)使用情况
|
||||
* @param string $start 开始标签
|
||||
* @param string $end 结束标签
|
||||
* @param integer|string $dec 小数位
|
||||
* @param string $start 开始标签
|
||||
* @param string $end 结束标签
|
||||
* @param integer|string $dec 小数位
|
||||
* @return integer
|
||||
*/
|
||||
public static function getRangeTime($start, $end, $dec = 6)
|
||||
@@ -70,9 +70,9 @@ class Debug
|
||||
|
||||
/**
|
||||
* 记录区间的内存使用情况
|
||||
* @param string $start 开始标签
|
||||
* @param string $end 结束标签
|
||||
* @param integer|string $dec 小数位
|
||||
* @param string $start 开始标签
|
||||
* @param string $end 结束标签
|
||||
* @param integer|string $dec 小数位
|
||||
* @return string
|
||||
*/
|
||||
public static function getRangeMem($start, $end, $dec = 2)
|
||||
@@ -109,9 +109,9 @@ class Debug
|
||||
|
||||
/**
|
||||
* 统计区间的内存峰值情况
|
||||
* @param string $start 开始标签
|
||||
* @param string $end 结束标签
|
||||
* @param integer|string $dec 小数位
|
||||
* @param string $start 开始标签
|
||||
* @param string $end 结束标签
|
||||
* @param integer|string $dec 小数位
|
||||
* @return mixed
|
||||
*/
|
||||
public static function getMemPeak($start, $end, $dec = 2)
|
||||
@@ -131,7 +131,7 @@ class Debug
|
||||
|
||||
/**
|
||||
* 获取文件加载信息
|
||||
* @param bool $detail 是否显示详细
|
||||
* @param bool $detail 是否显示详细
|
||||
* @return integer|array
|
||||
*/
|
||||
public static function getFile($detail = false)
|
||||
@@ -149,9 +149,9 @@ class Debug
|
||||
|
||||
/**
|
||||
* 浏览器友好的变量输出
|
||||
* @param mixed $var 变量
|
||||
* @param boolean $echo 是否输出 默认为true 如果为false 则返回输出字符串
|
||||
* @param string $label 标签 默认为空
|
||||
* @param mixed $var 变量
|
||||
* @param boolean $echo 是否输出 默认为true 如果为false 则返回输出字符串
|
||||
* @param string $label 标签 默认为空
|
||||
* @return void|string
|
||||
*/
|
||||
public static function dump($var, $echo = true, $label = null)
|
||||
|
||||
@@ -102,9 +102,9 @@ class File extends SplFileObject
|
||||
|
||||
/**
|
||||
* 移动文件
|
||||
* @param string $path 保存路径
|
||||
* @param string|bool $savename 保存的文件名 默认自动生成
|
||||
* @param boolean $replace 同名文件是否覆盖
|
||||
* @param string $path 保存路径
|
||||
* @param string|bool $savename 保存的文件名 默认自动生成
|
||||
* @param boolean $replace 同名文件是否覆盖
|
||||
* @return false|SplFileInfo false-失败 否则返回SplFileInfo实例
|
||||
*/
|
||||
public function move($path, $savename = true, $replace = true)
|
||||
|
||||
@@ -22,9 +22,9 @@ class Hook
|
||||
|
||||
/**
|
||||
* 动态添加行为扩展到某个标签
|
||||
* @param string $tag 标签名称
|
||||
* @param mixed $behavior 行为名称
|
||||
* @param bool $first 是否放到开头执行
|
||||
* @param string $tag 标签名称
|
||||
* @param mixed $behavior 行为名称
|
||||
* @param bool $first 是否放到开头执行
|
||||
* @return void
|
||||
*/
|
||||
public static function add($tag, $behavior, $first = false)
|
||||
@@ -43,8 +43,8 @@ class Hook
|
||||
|
||||
/**
|
||||
* 批量导入插件
|
||||
* @param array $data 插件信息
|
||||
* @param boolean $recursive 是否递归合并
|
||||
* @param array $data 插件信息
|
||||
* @param boolean $recursive 是否递归合并
|
||||
* @return void
|
||||
*/
|
||||
public static function import($tags, $recursive = true)
|
||||
@@ -132,10 +132,10 @@ class Hook
|
||||
|
||||
/**
|
||||
* 执行某个行为
|
||||
* @param mixed $class 要执行的行为
|
||||
* @param string $tag 方法名(标签名)
|
||||
* @param Mixed $params 传人的参数
|
||||
* @param mixed $extra 额外参数
|
||||
* @param mixed $class 要执行的行为
|
||||
* @param string $tag 方法名(标签名)
|
||||
* @param Mixed $params 传人的参数
|
||||
* @param mixed $extra 额外参数
|
||||
* @return mixed
|
||||
*/
|
||||
public static function exec($class, $tag = '', &$params = null,$extra=null)
|
||||
|
||||
@@ -40,9 +40,9 @@ class Lang
|
||||
|
||||
/**
|
||||
* 设置语言定义(不区分大小写)
|
||||
* @param string|array $name 语言变量
|
||||
* @param string $value 语言值
|
||||
* @param string $range 语言作用域
|
||||
* @param string|array $name 语言变量
|
||||
* @param string $value 语言值
|
||||
* @param string $range 语言作用域
|
||||
* @return mixed
|
||||
*/
|
||||
public static function set($name, $value = null, $range = '')
|
||||
@@ -94,9 +94,9 @@ class Lang
|
||||
|
||||
/**
|
||||
* 获取语言定义(不区分大小写)
|
||||
* @param string|null $name 语言变量
|
||||
* @param array $vars 变量替换
|
||||
* @param string $range 语言作用域
|
||||
* @param string|null $name 语言变量
|
||||
* @param array $vars 变量替换
|
||||
* @param string $range 语言作用域
|
||||
* @return mixed
|
||||
*/
|
||||
public static function has($name, $range = '')
|
||||
@@ -107,9 +107,9 @@ class Lang
|
||||
|
||||
/**
|
||||
* 获取语言定义(不区分大小写)
|
||||
* @param string|null $name 语言变量
|
||||
* @param array $vars 变量替换
|
||||
* @param string $range 语言作用域
|
||||
* @param string|null $name 语言变量
|
||||
* @param array $vars 变量替换
|
||||
* @param string $range 语言作用域
|
||||
* @return mixed
|
||||
*/
|
||||
public static function get($name = null, $vars = [], $range = '')
|
||||
|
||||
@@ -267,10 +267,10 @@ class Loader
|
||||
|
||||
/**
|
||||
* 实例化(分层)模型
|
||||
* @param string $name Model名称
|
||||
* @param string $layer 业务层名称
|
||||
* @param bool $appendSuffix 是否添加类名后缀
|
||||
* @param string $common 公共模块名
|
||||
* @param string $name Model名称
|
||||
* @param string $layer 业务层名称
|
||||
* @param bool $appendSuffix 是否添加类名后缀
|
||||
* @param string $common 公共模块名
|
||||
* @return Object
|
||||
* @throws ClassNotFoundException
|
||||
*/
|
||||
@@ -301,10 +301,10 @@ class Loader
|
||||
|
||||
/**
|
||||
* 实例化(分层)控制器 格式:[模块名/]控制器名
|
||||
* @param string $name 资源地址
|
||||
* @param string $layer 控制层名称
|
||||
* @param bool $appendSuffix 是否添加类名后缀
|
||||
* @param string $empty 空控制器名称
|
||||
* @param string $name 资源地址
|
||||
* @param string $layer 控制层名称
|
||||
* @param bool $appendSuffix 是否添加类名后缀
|
||||
* @param string $empty 空控制器名称
|
||||
* @return Object|false
|
||||
* @throws ClassNotFoundException
|
||||
*/
|
||||
@@ -327,10 +327,10 @@ class Loader
|
||||
|
||||
/**
|
||||
* 实例化验证类 格式:[模块名/]验证器名
|
||||
* @param string $name 资源地址
|
||||
* @param string $layer 验证层名称
|
||||
* @param bool $appendSuffix 是否添加类名后缀
|
||||
* @param string $common 公共模块名
|
||||
* @param string $name 资源地址
|
||||
* @param string $layer 验证层名称
|
||||
* @param bool $appendSuffix 是否添加类名后缀
|
||||
* @param string $common 公共模块名
|
||||
* @return Object|false
|
||||
* @throws ClassNotFoundException
|
||||
*/
|
||||
@@ -376,10 +376,10 @@ class Loader
|
||||
|
||||
/**
|
||||
* 远程调用模块的操作方法 参数格式 [模块/控制器/]操作
|
||||
* @param string $url 调用地址
|
||||
* @param string|array $vars 调用参数 支持字符串和数组
|
||||
* @param string $layer 要调用的控制层名称
|
||||
* @param bool $appendSuffix 是否添加类名后缀
|
||||
* @param string $url 调用地址
|
||||
* @param string|array $vars 调用参数 支持字符串和数组
|
||||
* @param string $layer 要调用的控制层名称
|
||||
* @param bool $appendSuffix 是否添加类名后缀
|
||||
* @return mixed
|
||||
*/
|
||||
public static function action($url, $vars = [], $layer = 'controller', $appendSuffix = false)
|
||||
@@ -403,8 +403,8 @@ class Loader
|
||||
/**
|
||||
* 字符串命名风格转换
|
||||
* type 0 将Java风格转换为C的风格 1 将C风格转换为Java的风格
|
||||
* @param string $name 字符串
|
||||
* @param integer $type 转换类型
|
||||
* @param string $name 字符串
|
||||
* @param integer $type 转换类型
|
||||
* @return string
|
||||
*/
|
||||
public static function parseName($name, $type = 0)
|
||||
|
||||
@@ -225,9 +225,9 @@ abstract class Model implements \JsonSerializable, \ArrayAccess
|
||||
/**
|
||||
* 修改器 设置数据对象值
|
||||
* @access public
|
||||
* @param string $name 属性名
|
||||
* @param mixed $value 属性值
|
||||
* @param array $data 数据
|
||||
* @param string $name 属性名
|
||||
* @param mixed $value 属性值
|
||||
* @param array $data 数据
|
||||
* @return $this
|
||||
*/
|
||||
public function setAttr($name, $value, $data = [])
|
||||
@@ -276,8 +276,8 @@ abstract class Model implements \JsonSerializable, \ArrayAccess
|
||||
/**
|
||||
* 数据写入 类型转换
|
||||
* @access public
|
||||
* @param mixed $value 值
|
||||
* @param string|array $type 要转换的类型
|
||||
* @param mixed $value 值
|
||||
* @param string|array $type 要转换的类型
|
||||
* @return mixed
|
||||
*/
|
||||
protected function writeTransform($value, $type)
|
||||
@@ -357,8 +357,8 @@ abstract class Model implements \JsonSerializable, \ArrayAccess
|
||||
/**
|
||||
* 数据读取 类型转换
|
||||
* @access public
|
||||
* @param mixed $value 值
|
||||
* @param string|array $type 要转换的类型
|
||||
* @param mixed $value 值
|
||||
* @param string|array $type 要转换的类型
|
||||
* @return mixed
|
||||
*/
|
||||
protected function readTransform($value, $type)
|
||||
@@ -513,10 +513,10 @@ abstract class Model implements \JsonSerializable, \ArrayAccess
|
||||
/**
|
||||
* 保存当前数据对象
|
||||
* @access public
|
||||
* @param array $data 数据
|
||||
* @param array $where 更新条件
|
||||
* @param bool $getId 新增的时候是否获取id
|
||||
* @param bool $replace 是否replace
|
||||
* @param array $data 数据
|
||||
* @param array $where 更新条件
|
||||
* @param bool $getId 新增的时候是否获取id
|
||||
* @param bool $replace 是否replace
|
||||
* @return integer
|
||||
*/
|
||||
public function save($data = [], $where = [], $getId = true, $replace = false)
|
||||
@@ -665,7 +665,7 @@ abstract class Model implements \JsonSerializable, \ArrayAccess
|
||||
/**
|
||||
* 是否为更新数据
|
||||
* @access public
|
||||
* @param bool $update
|
||||
* @param bool $update
|
||||
* @param mixed $where
|
||||
* @return $this
|
||||
*/
|
||||
@@ -730,7 +730,7 @@ abstract class Model implements \JsonSerializable, \ArrayAccess
|
||||
* 设置字段验证
|
||||
* @access public
|
||||
* @param array|string|bool $rule 验证规则 true表示自动读取验证器类
|
||||
* @param array $msg 提示信息
|
||||
* @param array $msg 提示信息
|
||||
* @return $this
|
||||
*/
|
||||
public function validate($rule = true, $msg = [])
|
||||
@@ -808,9 +808,9 @@ abstract class Model implements \JsonSerializable, \ArrayAccess
|
||||
/**
|
||||
* 注册回调方法
|
||||
* @access public
|
||||
* @param string $event 事件名
|
||||
* @param callable $callback 回调方法
|
||||
* @param bool $override 是否覆盖
|
||||
* @param string $event 事件名
|
||||
* @param callable $callback 回调方法
|
||||
* @param bool $override 是否覆盖
|
||||
* @return void
|
||||
*/
|
||||
public static function event($event, $callback, $override = false)
|
||||
@@ -825,8 +825,8 @@ abstract class Model implements \JsonSerializable, \ArrayAccess
|
||||
/**
|
||||
* 触发事件
|
||||
* @access protected
|
||||
* @param string $event 事件名
|
||||
* @param mixed $params 传入参数(引用)
|
||||
* @param string $event 事件名
|
||||
* @param mixed $params 传入参数(引用)
|
||||
* @return bool
|
||||
*/
|
||||
protected function trigger($event, &$params)
|
||||
@@ -847,8 +847,8 @@ abstract class Model implements \JsonSerializable, \ArrayAccess
|
||||
/**
|
||||
* 写入数据
|
||||
* @access public
|
||||
* @param array $data 数据数组
|
||||
* @param bool $replace 是否replace
|
||||
* @param array $data 数据数组
|
||||
* @param bool $replace 是否replace
|
||||
* @return $this
|
||||
*/
|
||||
public static function create($data = [], $replace = false)
|
||||
@@ -861,8 +861,8 @@ abstract class Model implements \JsonSerializable, \ArrayAccess
|
||||
/**
|
||||
* 更新数据
|
||||
* @access public
|
||||
* @param array $data 数据数组
|
||||
* @param array $where 更新条件
|
||||
* @param array $data 数据数组
|
||||
* @param array $where 更新条件
|
||||
* @return $this
|
||||
*/
|
||||
public static function update($data = [], $where = [])
|
||||
@@ -905,9 +905,9 @@ abstract class Model implements \JsonSerializable, \ArrayAccess
|
||||
/**
|
||||
* 分析查询表达式
|
||||
* @access public
|
||||
* @param mixed $data 主键列表或者查询条件(闭包)
|
||||
* @param string $with 关联预查询
|
||||
* @param bool $cache 是否缓存
|
||||
* @param mixed $data 主键列表或者查询条件(闭包)
|
||||
* @param string $with 关联预查询
|
||||
* @param bool $cache 是否缓存
|
||||
* @return Query
|
||||
*/
|
||||
protected static function parseQuery(&$data, $with, $cache)
|
||||
@@ -957,8 +957,8 @@ abstract class Model implements \JsonSerializable, \ArrayAccess
|
||||
/**
|
||||
* 命名范围
|
||||
* @access public
|
||||
* @param string|array|Closure $name 命名范围名称 逗号分隔
|
||||
* @param mixed $params 参数调用
|
||||
* @param string|array|Closure $name 命名范围名称 逗号分隔
|
||||
* @param mixed $params 参数调用
|
||||
* @return Model
|
||||
*/
|
||||
public static function scope($name, $params = [])
|
||||
@@ -986,10 +986,10 @@ abstract class Model implements \JsonSerializable, \ArrayAccess
|
||||
/**
|
||||
* 根据关联条件查询当前模型
|
||||
* @access public
|
||||
* @param string $relation 关联方法名
|
||||
* @param string $operator 比较操作符
|
||||
* @param integer $count 个数
|
||||
* @param string $id 关联表的统计字段
|
||||
* @param string $relation 关联方法名
|
||||
* @param string $operator 比较操作符
|
||||
* @param integer $count 个数
|
||||
* @param string $id 关联表的统计字段
|
||||
* @return Model
|
||||
*/
|
||||
public static function has($relation, $operator = '>=', $count = 1, $id = '*')
|
||||
@@ -1011,8 +1011,8 @@ abstract class Model implements \JsonSerializable, \ArrayAccess
|
||||
/**
|
||||
* 根据关联条件查询当前模型
|
||||
* @access public
|
||||
* @param string $relation 关联方法名
|
||||
* @param mixed $where 查询条件(数组或者闭包)
|
||||
* @param string $relation 关联方法名
|
||||
* @param mixed $where 查询条件(数组或者闭包)
|
||||
* @return Model
|
||||
*/
|
||||
public static function hasWhere($relation, $where = [])
|
||||
@@ -1077,8 +1077,8 @@ abstract class Model implements \JsonSerializable, \ArrayAccess
|
||||
/**
|
||||
* 预载入关联查询 返回数据集
|
||||
* @access public
|
||||
* @param array $resultSet 数据集
|
||||
* @param string $relation 关联名
|
||||
* @param array $resultSet 数据集
|
||||
* @param string $relation 关联名
|
||||
* @return array
|
||||
*/
|
||||
public function eagerlyResultSet($resultSet, $relation)
|
||||
@@ -1089,8 +1089,8 @@ abstract class Model implements \JsonSerializable, \ArrayAccess
|
||||
/**
|
||||
* 预载入关联查询 返回模型对象
|
||||
* @access public
|
||||
* @param Model $result 数据对象
|
||||
* @param string $relation 关联名
|
||||
* @param Model $result 数据对象
|
||||
* @param string $relation 关联名
|
||||
* @return Model
|
||||
*/
|
||||
public function eagerlyResult($result, $relation)
|
||||
@@ -1224,8 +1224,8 @@ abstract class Model implements \JsonSerializable, \ArrayAccess
|
||||
/**
|
||||
* 修改器 设置数据对象的值
|
||||
* @access public
|
||||
* @param string $name 名称
|
||||
* @param mixed $value 值
|
||||
* @param string $name 名称
|
||||
* @param mixed $value 值
|
||||
* @return void
|
||||
*/
|
||||
public function __set($name, $value)
|
||||
|
||||
@@ -141,8 +141,8 @@ class Request
|
||||
/**
|
||||
* Hook 方法注入
|
||||
* @access public
|
||||
* @param string|array $method 方法名
|
||||
* @param mixed $callback callable
|
||||
* @param string|array $method 方法名
|
||||
* @param mixed $callback callable
|
||||
* @return void
|
||||
*/
|
||||
public static function hook($method, $callback = null)
|
||||
@@ -171,12 +171,12 @@ class Request
|
||||
/**
|
||||
* 创建一个URL请求
|
||||
* @access public
|
||||
* @param string $uri URL地址
|
||||
* @param string $method 请求类型
|
||||
* @param array $params 请求参数
|
||||
* @param array $cookie
|
||||
* @param array $files
|
||||
* @param array $server
|
||||
* @param string $uri URL地址
|
||||
* @param string $method 请求类型
|
||||
* @param array $params 请求参数
|
||||
* @param array $cookie
|
||||
* @param array $files
|
||||
* @param array $server
|
||||
* @return \think\Request
|
||||
*/
|
||||
public static function create($uri, $method = 'GET', $params = [], $cookie = [], $files = [], $server = [])
|
||||
@@ -457,8 +457,8 @@ class Request
|
||||
/**
|
||||
* 设置资源类型
|
||||
* @access public
|
||||
* @param string|array $type 资源类型名
|
||||
* @param string $val 资源类型
|
||||
* @param string|array $type 资源类型名
|
||||
* @param string $val 资源类型
|
||||
* @return void
|
||||
*/
|
||||
public function mimeType($type, $val = '')
|
||||
@@ -586,9 +586,9 @@ class Request
|
||||
/**
|
||||
* 设置获取获取当前请求的参数
|
||||
* @access public
|
||||
* @param string|array $name 变量名
|
||||
* @param mixed $default 默认值
|
||||
* @param string|array $filter 过滤方法
|
||||
* @param string|array $name 变量名
|
||||
* @param mixed $default 默认值
|
||||
* @param string|array $filter 过滤方法
|
||||
* @return mixed
|
||||
*/
|
||||
public function param($name = '', $default = null, $filter = null)
|
||||
@@ -623,9 +623,9 @@ class Request
|
||||
/**
|
||||
* 设置获取获取GET参数
|
||||
* @access public
|
||||
* @param string|array $name 变量名
|
||||
* @param mixed $default 默认值
|
||||
* @param string|array $filter 过滤方法
|
||||
* @param string|array $name 变量名
|
||||
* @param mixed $default 默认值
|
||||
* @param string|array $filter 过滤方法
|
||||
* @return mixed
|
||||
*/
|
||||
public function get($name = '', $default = null, $filter = null)
|
||||
@@ -641,9 +641,9 @@ class Request
|
||||
/**
|
||||
* 设置获取获取POST参数
|
||||
* @access public
|
||||
* @param string $name 变量名
|
||||
* @param mixed $default 默认值
|
||||
* @param string|array $filter 过滤方法
|
||||
* @param string $name 变量名
|
||||
* @param mixed $default 默认值
|
||||
* @param string|array $filter 过滤方法
|
||||
* @return mixed
|
||||
*/
|
||||
public function post($name = '', $default = null, $filter = null)
|
||||
@@ -659,9 +659,9 @@ class Request
|
||||
/**
|
||||
* 设置获取获取PUT参数
|
||||
* @access public
|
||||
* @param string|array $name 变量名
|
||||
* @param mixed $default 默认值
|
||||
* @param string|array $filter 过滤方法
|
||||
* @param string|array $name 变量名
|
||||
* @param mixed $default 默认值
|
||||
* @param string|array $filter 过滤方法
|
||||
* @return mixed
|
||||
*/
|
||||
public function put($name = '', $default = null, $filter = null)
|
||||
@@ -678,9 +678,9 @@ class Request
|
||||
/**
|
||||
* 设置获取获取DELETE参数
|
||||
* @access public
|
||||
* @param string|array $name 变量名
|
||||
* @param mixed $default 默认值
|
||||
* @param string|array $filter 过滤方法
|
||||
* @param string|array $name 变量名
|
||||
* @param mixed $default 默认值
|
||||
* @param string|array $filter 过滤方法
|
||||
* @return mixed
|
||||
*/
|
||||
public function delete($name = '', $default = null, $filter = null)
|
||||
@@ -696,9 +696,9 @@ class Request
|
||||
|
||||
/**
|
||||
* 获取request变量
|
||||
* @param string $name 数据名称
|
||||
* @param string $default 默认值
|
||||
* @param string|array $filter 过滤方法
|
||||
* @param string $name 数据名称
|
||||
* @param string $default 默认值
|
||||
* @param string|array $filter 过滤方法
|
||||
* @return mixed
|
||||
*/
|
||||
public function request($name = '', $default = null, $filter = null)
|
||||
@@ -714,9 +714,9 @@ class Request
|
||||
/**
|
||||
* 获取session数据
|
||||
* @access public
|
||||
* @param string|array $name 数据名称
|
||||
* @param string $default 默认值
|
||||
* @param string|array $filter 过滤方法
|
||||
* @param string|array $name 数据名称
|
||||
* @param string $default 默认值
|
||||
* @param string|array $filter 过滤方法
|
||||
* @return mixed
|
||||
*/
|
||||
public function session($name = '', $default = null, $filter = null)
|
||||
@@ -732,9 +732,9 @@ class Request
|
||||
/**
|
||||
* 获取cookie参数
|
||||
* @access public
|
||||
* @param string|array $name 数据名称
|
||||
* @param string $default 默认值
|
||||
* @param string|array $filter 过滤方法
|
||||
* @param string|array $name 数据名称
|
||||
* @param string $default 默认值
|
||||
* @param string|array $filter 过滤方法
|
||||
* @return mixed
|
||||
*/
|
||||
public function cookie($name = '', $default = null, $filter = null)
|
||||
@@ -750,9 +750,9 @@ class Request
|
||||
/**
|
||||
* 获取server参数
|
||||
* @access public
|
||||
* @param string|array $name 数据名称
|
||||
* @param string $default 默认值
|
||||
* @param string|array $filter 过滤方法
|
||||
* @param string|array $name 数据名称
|
||||
* @param string $default 默认值
|
||||
* @param string|array $filter 过滤方法
|
||||
* @return mixed
|
||||
*/
|
||||
public function server($name = '', $default = null, $filter = null)
|
||||
@@ -827,9 +827,9 @@ class Request
|
||||
|
||||
/**
|
||||
* 获取环境变量
|
||||
* @param string|array $name 数据名称
|
||||
* @param string $default 默认值
|
||||
* @param string|array $filter 过滤方法
|
||||
* @param string|array $name 数据名称
|
||||
* @param string $default 默认值
|
||||
* @param string|array $filter 过滤方法
|
||||
* @return mixed
|
||||
*/
|
||||
public function env($name = '', $default = null, $filter = null)
|
||||
@@ -845,8 +845,8 @@ class Request
|
||||
/**
|
||||
* 设置或者获取当前的Header
|
||||
* @access public
|
||||
* @param string|array $name header名称
|
||||
* @param string $default 默认值
|
||||
* @param string|array $name header名称
|
||||
* @param string $default 默认值
|
||||
* @return string
|
||||
*/
|
||||
public function header($name = '', $default = null)
|
||||
@@ -879,9 +879,9 @@ class Request
|
||||
|
||||
/**
|
||||
* 获取PATH_INFO
|
||||
* @param string $name 数据名称
|
||||
* @param string $default 默认值
|
||||
* @param string|array $filter 过滤方法
|
||||
* @param string $name 数据名称
|
||||
* @param string $default 默认值
|
||||
* @param string|array $filter 过滤方法
|
||||
* @return mixed
|
||||
*/
|
||||
public function pathParam($name = '', $default = null, $filter = null)
|
||||
@@ -898,10 +898,10 @@ class Request
|
||||
|
||||
/**
|
||||
* 获取变量 支持过滤和默认值
|
||||
* @param array $data 数据源
|
||||
* @param string $name 字段名
|
||||
* @param mixed $default 默认值
|
||||
* @param string|array $filter 过滤函数
|
||||
* @param array $data 数据源
|
||||
* @param string $name 字段名
|
||||
* @param mixed $default 默认值
|
||||
* @param string|array $filter 过滤函数
|
||||
* @return mixed
|
||||
*/
|
||||
public function input($data = [], $name = '', $default = null, $filter = null)
|
||||
@@ -963,9 +963,9 @@ class Request
|
||||
|
||||
/**
|
||||
* 递归过滤给定的值
|
||||
* @param mixed $value 键值
|
||||
* @param mixed $key 键名
|
||||
* @param array $filters 过滤方法+默认值
|
||||
* @param mixed $value 键值
|
||||
* @param mixed $key 键名
|
||||
* @param array $filters 过滤方法+默认值
|
||||
* @return mixed
|
||||
*/
|
||||
private function filterValue(&$value, $key, $filters)
|
||||
@@ -1050,9 +1050,9 @@ class Request
|
||||
/**
|
||||
* 是否存在某个请求参数
|
||||
* @access public
|
||||
* @param string $name 变量名
|
||||
* @param string $type 变量类型
|
||||
* @param bool $checkEmpty 是否检测空值
|
||||
* @param string $name 变量名
|
||||
* @param string $type 变量类型
|
||||
* @param bool $checkEmpty 是否检测空值
|
||||
* @return mixed
|
||||
*/
|
||||
public function has($name, $type = 'param', $checkEmpty = false)
|
||||
@@ -1076,8 +1076,8 @@ class Request
|
||||
/**
|
||||
* 获取指定的参数
|
||||
* @access public
|
||||
* @param string|array $name 变量名
|
||||
* @param string $type 变量类型
|
||||
* @param string|array $name 变量名
|
||||
* @param string $type 变量类型
|
||||
* @return mixed
|
||||
*/
|
||||
public function only($name, $type = 'param')
|
||||
@@ -1098,8 +1098,8 @@ class Request
|
||||
/**
|
||||
* 排除指定参数获取
|
||||
* @access public
|
||||
* @param string|array $name 变量名
|
||||
* @param string $type 变量类型
|
||||
* @param string|array $name 变量名
|
||||
* @param string $type 变量类型
|
||||
* @return mixed
|
||||
*/
|
||||
public function except($name, $type = 'param')
|
||||
@@ -1158,8 +1158,8 @@ class Request
|
||||
|
||||
/**
|
||||
* 获取客户端IP地址
|
||||
* @param integer $type 返回类型 0 返回IP地址 1 返回IPV4地址数字
|
||||
* @param boolean $adv 是否进行高级模式获取(有可能被伪装)
|
||||
* @param integer $type 返回类型 0 返回IP地址 1 返回IPV4地址数字
|
||||
* @param boolean $adv 是否进行高级模式获取(有可能被伪装)
|
||||
* @return mixed
|
||||
*/
|
||||
public function ip($type = 0, $adv = false)
|
||||
|
||||
@@ -44,9 +44,9 @@ class Response
|
||||
/**
|
||||
* 架构函数
|
||||
* @access public
|
||||
* @param mixed $data 输出数据
|
||||
* @param string $type 输出类型
|
||||
* @param array $options 输出参数
|
||||
* @param mixed $data 输出数据
|
||||
* @param string $type 输出类型
|
||||
* @param array $options 输出参数
|
||||
*/
|
||||
public function __construct($data = '', $type = '', $options = [])
|
||||
{
|
||||
@@ -67,9 +67,9 @@ class Response
|
||||
/**
|
||||
* 创建Response对象
|
||||
* @access public
|
||||
* @param mixed $data 输出数据
|
||||
* @param string $type 输出类型
|
||||
* @param array $options 输出参数
|
||||
* @param mixed $data 输出数据
|
||||
* @param string $type 输出类型
|
||||
* @param array $options 输出参数
|
||||
* @return Response
|
||||
*/
|
||||
public static function create($data = '', $type = '', $options = [])
|
||||
@@ -183,8 +183,8 @@ class Response
|
||||
/**
|
||||
* 设置响应头
|
||||
* @access public
|
||||
* @param string|array $name 参数名
|
||||
* @param string $value 参数值
|
||||
* @param string|array $name 参数名
|
||||
* @param string $value 参数值
|
||||
* @return $this
|
||||
*/
|
||||
public function header($name, $value = null)
|
||||
@@ -265,8 +265,8 @@ class Response
|
||||
|
||||
/**
|
||||
* 页面输出类型
|
||||
* @param string $contentType 输出类型
|
||||
* @param string $charset 输出编码
|
||||
* @param string $contentType 输出类型
|
||||
* @param string $charset 输出编码
|
||||
* @return $this
|
||||
*/
|
||||
public function contentType($contentType, $charset = 'utf-8')
|
||||
|
||||
@@ -70,8 +70,8 @@ class Route
|
||||
/**
|
||||
* 注册或者获取URL映射规则
|
||||
* @access public
|
||||
* @param string|array $map 映射名
|
||||
* @param string $route 路由地址
|
||||
* @param string|array $map 映射名
|
||||
* @param string $route 路由地址
|
||||
* @return mixed
|
||||
*/
|
||||
public static function map($map = '', $route = '')
|
||||
@@ -82,8 +82,8 @@ class Route
|
||||
/**
|
||||
* 注册或者获取变量规则
|
||||
* @access public
|
||||
* @param string|array $name 变量名
|
||||
* @param string $rule 变量规则
|
||||
* @param string|array $name 变量名
|
||||
* @param string $rule 变量规则
|
||||
* @return mixed
|
||||
*/
|
||||
public static function pattern($name = '', $rule = '')
|
||||
@@ -94,8 +94,8 @@ class Route
|
||||
/**
|
||||
* 注册或者获取子域名部署规则
|
||||
* @access public
|
||||
* @param string|array $domain 子域名
|
||||
* @param mixed $rule 路由规则
|
||||
* @param string|array $domain 子域名
|
||||
* @param mixed $rule 路由规则
|
||||
* @return mixed
|
||||
*/
|
||||
public static function domain($domain = '', $rule = '')
|
||||
@@ -106,9 +106,9 @@ class Route
|
||||
/**
|
||||
* 设置属性
|
||||
* @access public
|
||||
* @param string $var 属性名称
|
||||
* @param string|array $name 变量名称
|
||||
* @param mixed $value 变量值
|
||||
* @param string $var 属性名称
|
||||
* @param string|array $name 变量名称
|
||||
* @param mixed $value 变量值
|
||||
* @return mixed
|
||||
*/
|
||||
private static function setting($var, $name = '', $value = '')
|
||||
@@ -125,8 +125,8 @@ class Route
|
||||
/**
|
||||
* 设置和读取路由绑定
|
||||
* @access public
|
||||
* @param string $type 请求类型
|
||||
* @param mixed $bind 绑定信息
|
||||
* @param string $type 请求类型
|
||||
* @param mixed $bind 绑定信息
|
||||
* @return mixed
|
||||
*/
|
||||
public static function bind($type, $bind = '')
|
||||
@@ -141,8 +141,8 @@ class Route
|
||||
/**
|
||||
* 导入配置文件的路由规则
|
||||
* @access public
|
||||
* @param array $rule 路由规则
|
||||
* @param string $type 请求类型
|
||||
* @param array $rule 路由规则
|
||||
* @param string $type 请求类型
|
||||
* @return void
|
||||
*/
|
||||
public static function import(array $rule, $type = '*')
|
||||
@@ -200,12 +200,12 @@ class Route
|
||||
/**
|
||||
* 注册路由规则
|
||||
* @access public
|
||||
* @param string $rule 路由规则
|
||||
* @param string $route 路由地址
|
||||
* @param string $type 请求类型
|
||||
* @param array $option 路由参数
|
||||
* @param array $pattern 变量规则
|
||||
* @param string $group 所属分组
|
||||
* @param string $rule 路由规则
|
||||
* @param string $route 路由地址
|
||||
* @param string $type 请求类型
|
||||
* @param array $option 路由参数
|
||||
* @param array $pattern 变量规则
|
||||
* @param string $group 所属分组
|
||||
* @return void
|
||||
*/
|
||||
public static function rule($rule, $route = '', $type = '*', $option = [], $pattern = [], $group = '')
|
||||
@@ -268,11 +268,11 @@ class Route
|
||||
/**
|
||||
* 注册路由分组
|
||||
* @access public
|
||||
* @param string|array $name 分组名称或者参数
|
||||
* @param array|\Closure $routes 路由地址
|
||||
* @param array $option 路由参数
|
||||
* @param string $type 请求类型
|
||||
* @param array $pattern 变量规则
|
||||
* @param string|array $name 分组名称或者参数
|
||||
* @param array|\Closure $routes 路由地址
|
||||
* @param array $option 路由参数
|
||||
* @param string $type 请求类型
|
||||
* @param array $pattern 变量规则
|
||||
* @return void
|
||||
*/
|
||||
public static function group($name, $routes, $option = [], $type = '*', $pattern = [])
|
||||
@@ -308,11 +308,11 @@ class Route
|
||||
/**
|
||||
* 注册路由
|
||||
* @access public
|
||||
* @param string $rule 路由规则
|
||||
* @param string $route 路由地址
|
||||
* @param array $option 路由参数
|
||||
* @param array $pattern 变量规则
|
||||
* @param string $group 所属分组
|
||||
* @param string $rule 路由规则
|
||||
* @param string $route 路由地址
|
||||
* @param array $option 路由参数
|
||||
* @param array $pattern 变量规则
|
||||
* @param string $group 所属分组
|
||||
* @return void
|
||||
*/
|
||||
public static function any($rule, $route = '', $option = [], $pattern = [], $group = '')
|
||||
@@ -323,11 +323,11 @@ class Route
|
||||
/**
|
||||
* 注册GET路由
|
||||
* @access public
|
||||
* @param string $rule 路由规则
|
||||
* @param string $route 路由地址
|
||||
* @param array $option 路由参数
|
||||
* @param array $pattern 变量规则
|
||||
* @param string $group 所属分组
|
||||
* @param string $rule 路由规则
|
||||
* @param string $route 路由地址
|
||||
* @param array $option 路由参数
|
||||
* @param array $pattern 变量规则
|
||||
* @param string $group 所属分组
|
||||
* @return void
|
||||
*/
|
||||
public static function get($rule, $route = '', $option = [], $pattern = [], $group = '')
|
||||
@@ -338,11 +338,11 @@ class Route
|
||||
/**
|
||||
* 注册POST路由
|
||||
* @access public
|
||||
* @param string $rule 路由规则
|
||||
* @param string $route 路由地址
|
||||
* @param array $option 路由参数
|
||||
* @param array $pattern 变量规则
|
||||
* @param string $group 所属分组
|
||||
* @param string $rule 路由规则
|
||||
* @param string $route 路由地址
|
||||
* @param array $option 路由参数
|
||||
* @param array $pattern 变量规则
|
||||
* @param string $group 所属分组
|
||||
* @return void
|
||||
*/
|
||||
public static function post($rule, $route = '', $option = [], $pattern = [], $group = '')
|
||||
@@ -353,11 +353,11 @@ class Route
|
||||
/**
|
||||
* 注册PUT路由
|
||||
* @access public
|
||||
* @param string $rule 路由规则
|
||||
* @param string $route 路由地址
|
||||
* @param array $option 路由参数
|
||||
* @param array $pattern 变量规则
|
||||
* @param string $group 所属分组
|
||||
* @param string $rule 路由规则
|
||||
* @param string $route 路由地址
|
||||
* @param array $option 路由参数
|
||||
* @param array $pattern 变量规则
|
||||
* @param string $group 所属分组
|
||||
* @return void
|
||||
*/
|
||||
public static function put($rule, $route = '', $option = [], $pattern = [], $group = '')
|
||||
@@ -368,11 +368,11 @@ class Route
|
||||
/**
|
||||
* 注册DELETE路由
|
||||
* @access public
|
||||
* @param string $rule 路由规则
|
||||
* @param string $route 路由地址
|
||||
* @param array $option 路由参数
|
||||
* @param array $pattern 变量规则
|
||||
* @param string $group 所属分组
|
||||
* @param string $rule 路由规则
|
||||
* @param string $route 路由地址
|
||||
* @param array $option 路由参数
|
||||
* @param array $pattern 变量规则
|
||||
* @param string $group 所属分组
|
||||
* @return void
|
||||
*/
|
||||
public static function delete($rule, $route = '', $option = [], $pattern = [], $group = '')
|
||||
@@ -383,10 +383,10 @@ class Route
|
||||
/**
|
||||
* 注册资源路由
|
||||
* @access public
|
||||
* @param string $rule 路由规则
|
||||
* @param string $route 路由地址
|
||||
* @param array $option 路由参数
|
||||
* @param array $pattern 变量规则
|
||||
* @param string $rule 路由规则
|
||||
* @param string $route 路由地址
|
||||
* @param array $option 路由参数
|
||||
* @param array $pattern 变量规则
|
||||
* @return void
|
||||
*/
|
||||
public static function resource($rule, $route = '', $option = [], $pattern = [])
|
||||
@@ -427,10 +427,10 @@ class Route
|
||||
/**
|
||||
* 注册控制器路由 操作方法对应不同的请求后缀
|
||||
* @access public
|
||||
* @param string $rule 路由规则
|
||||
* @param string $route 路由地址
|
||||
* @param array $option 路由参数
|
||||
* @param array $pattern 变量规则
|
||||
* @param string $rule 路由规则
|
||||
* @param string $route 路由地址
|
||||
* @param array $option 路由参数
|
||||
* @param array $pattern 变量规则
|
||||
* @return void
|
||||
*/
|
||||
public static function controller($rule, $route = '', $option = [], $pattern = [])
|
||||
@@ -443,9 +443,9 @@ class Route
|
||||
/**
|
||||
* 注册别名路由
|
||||
* @access public
|
||||
* @param string|array $rule 路由别名
|
||||
* @param string $route 路由地址
|
||||
* @param array $option 路由参数
|
||||
* @param string|array $rule 路由别名
|
||||
* @param string $route 路由地址
|
||||
* @param array $option 路由参数
|
||||
* @return void
|
||||
*/
|
||||
public static function alias($rule = null, $route = '', $option = [])
|
||||
@@ -462,8 +462,8 @@ class Route
|
||||
/**
|
||||
* 设置不同请求类型下面的方法前缀
|
||||
* @access public
|
||||
* @param string $method 请求类型
|
||||
* @param string $prefix 类型前缀
|
||||
* @param string $method 请求类型
|
||||
* @param string $prefix 类型前缀
|
||||
* @return void
|
||||
*/
|
||||
public static function setMethodPrefix($method, $prefix = '')
|
||||
@@ -478,8 +478,8 @@ class Route
|
||||
/**
|
||||
* rest方法定义和修改
|
||||
* @access public
|
||||
* @param string $name 方法名称
|
||||
* @param array $resourece 资源
|
||||
* @param string $name 方法名称
|
||||
* @param array $resourece 资源
|
||||
* @return void
|
||||
*/
|
||||
public static function rest($name, $resource = [])
|
||||
@@ -494,9 +494,9 @@ class Route
|
||||
/**
|
||||
* 注册未匹配路由规则后的处理
|
||||
* @access public
|
||||
* @param string $route 路由地址
|
||||
* @param string $method 请求类型
|
||||
* @param array $option 路由参数
|
||||
* @param string $route 路由地址
|
||||
* @param string $method 请求类型
|
||||
* @param array $option 路由参数
|
||||
* @return void
|
||||
*/
|
||||
public static function miss($route, $method = '*', $option = [])
|
||||
@@ -522,7 +522,7 @@ class Route
|
||||
/**
|
||||
* 检测子域名部署
|
||||
* @access public
|
||||
* @param \think\Request $request Request请求对象
|
||||
* @param Request $request Request请求对象
|
||||
* @return void
|
||||
*/
|
||||
public static function checkDomain($request)
|
||||
@@ -615,10 +615,10 @@ class Route
|
||||
/**
|
||||
* 检测URL路由
|
||||
* @access public
|
||||
* @param \think\Request $request Request请求对象
|
||||
* @param string $url URL地址
|
||||
* @param string $depr URL分隔符
|
||||
* @param bool $checkDomain 是否检测域名规则
|
||||
* @param Request $request Request请求对象
|
||||
* @param string $url URL地址
|
||||
* @param string $depr URL分隔符
|
||||
* @param bool $checkDomain 是否检测域名规则
|
||||
* @return false|array
|
||||
*/
|
||||
public static function check($request, $url, $depr = '/', $checkDomain = false)
|
||||
@@ -756,8 +756,8 @@ class Route
|
||||
/**
|
||||
* 检测URL绑定
|
||||
* @access private
|
||||
* @param string $url URL地址
|
||||
* @param array $rules 路由规则
|
||||
* @param string $url URL地址
|
||||
* @param array $rules 路由规则
|
||||
* @return false
|
||||
*/
|
||||
private static function checkUrlBind(&$url, &$rules)
|
||||
@@ -791,8 +791,8 @@ class Route
|
||||
/**
|
||||
* 绑定到类
|
||||
* @access public
|
||||
* @param string $url URL地址
|
||||
* @param string $class 类名(带命名空间)
|
||||
* @param string $url URL地址
|
||||
* @param string $class 类名(带命名空间)
|
||||
* @return array
|
||||
*/
|
||||
public static function bindToClass($url, $class)
|
||||
@@ -807,8 +807,8 @@ class Route
|
||||
/**
|
||||
* 绑定到命名空间
|
||||
* @access public
|
||||
* @param string $url URL地址
|
||||
* @param string $namespace 命名空间
|
||||
* @param string $url URL地址
|
||||
* @param string $namespace 命名空间
|
||||
* @return array
|
||||
*/
|
||||
public static function bindToNamespace($url, $namespace)
|
||||
@@ -825,8 +825,8 @@ class Route
|
||||
/**
|
||||
* 绑定到控制器类
|
||||
* @access public
|
||||
* @param string $url URL地址
|
||||
* @param string $module 模块名
|
||||
* @param string $url URL地址
|
||||
* @param string $module 模块名
|
||||
* @return array
|
||||
*/
|
||||
public static function bindToController($url, $controller)
|
||||
@@ -842,8 +842,8 @@ class Route
|
||||
/**
|
||||
* 绑定到模块/控制器
|
||||
* @access public
|
||||
* @param string $url URL地址
|
||||
* @param string $class 控制器类名(带命名空间)
|
||||
* @param string $url URL地址
|
||||
* @param string $class 控制器类名(带命名空间)
|
||||
* @return array
|
||||
*/
|
||||
public static function bindToModule($url, $controller)
|
||||
@@ -859,9 +859,9 @@ class Route
|
||||
/**
|
||||
* 路由参数有效性检查
|
||||
* @access private
|
||||
* @param array $option 路由参数
|
||||
* @param string $url URL地址
|
||||
* @param \think\Request $request Request对象
|
||||
* @param array $option 路由参数
|
||||
* @param string $url URL地址
|
||||
* @param Request $request Request对象
|
||||
* @return bool
|
||||
*/
|
||||
private static function checkOption($option, $url, $request)
|
||||
@@ -882,11 +882,11 @@ class Route
|
||||
/**
|
||||
* 检测路由规则
|
||||
* @access private
|
||||
* @param string $rule 路由规则
|
||||
* @param string $url URL地址
|
||||
* @param string $route 路由地址
|
||||
* @param array $pattern 变量规则
|
||||
* @param array $option 路由参数
|
||||
* @param string $rule 路由规则
|
||||
* @param string $url URL地址
|
||||
* @param string $route 路由地址
|
||||
* @param array $pattern 变量规则
|
||||
* @param array $option 路由参数
|
||||
* @return array|false
|
||||
*/
|
||||
private static function checkRule($rule, $route, $url, $pattern, $option)
|
||||
@@ -951,10 +951,10 @@ class Route
|
||||
/**
|
||||
* 解析模块的URL地址 [模块/控制器/操作?]参数1=值1&参数2=值2...
|
||||
* @access public
|
||||
* @param string $url URL地址
|
||||
* @param string $depr URL分隔符
|
||||
* @param bool $autoSearch 是否自动深度搜索控制器
|
||||
* @param integer $paramType URL参数解析方式 0 名称解析 1 顺序解析
|
||||
* @param string $url URL地址
|
||||
* @param string $depr URL分隔符
|
||||
* @param bool $autoSearch 是否自动深度搜索控制器
|
||||
* @param integer $paramType URL参数解析方式 0 名称解析 1 顺序解析
|
||||
* @return array
|
||||
*/
|
||||
public static function parseUrl($url, $depr = '/', $autoSearch = false, $paramType = 0)
|
||||
@@ -979,10 +979,10 @@ class Route
|
||||
/**
|
||||
* 解析规范的路由地址 地址格式 [模块/控制器/操作?]参数1=值1&参数2=值2...
|
||||
* @access private
|
||||
* @param string $url URL地址
|
||||
* @param bool $autoSearch 是否自动深度搜索控制器
|
||||
* @param bool $reverse 是否反转解析URL
|
||||
* @param integer $paramType URL参数解析方式 0 名称解析 1 顺序解析
|
||||
* @param string $url URL地址
|
||||
* @param bool $autoSearch 是否自动深度搜索控制器
|
||||
* @param bool $reverse 是否反转解析URL
|
||||
* @param integer $paramType URL参数解析方式 0 名称解析 1 顺序解析
|
||||
* @return array
|
||||
*/
|
||||
private static function parseRoute($url, $autoSearch = false, $reverse = false, $paramType = 0)
|
||||
@@ -1060,10 +1060,10 @@ class Route
|
||||
/**
|
||||
* 检测URL和规则路由是否匹配
|
||||
* @access private
|
||||
* @param string $url URL地址
|
||||
* @param string $rule 路由规则
|
||||
* @param array $pattern 变量规则
|
||||
* @param bool $merge 合并额外变量
|
||||
* @param string $url URL地址
|
||||
* @param string $rule 路由规则
|
||||
* @param array $pattern 变量规则
|
||||
* @param bool $merge 合并额外变量
|
||||
* @return array|false
|
||||
*/
|
||||
private static function match($url, $rule, $pattern, $merge)
|
||||
@@ -1119,11 +1119,11 @@ class Route
|
||||
/**
|
||||
* 解析规则路由
|
||||
* @access private
|
||||
* @param string $rule 路由规则
|
||||
* @param string $route 路由地址
|
||||
* @param string $pathinfo URL地址
|
||||
* @param array $matches 匹配的变量
|
||||
* @param bool $merge 合并额外变量
|
||||
* @param string $rule 路由规则
|
||||
* @param string $route 路由地址
|
||||
* @param string $pathinfo URL地址
|
||||
* @param array $matches 匹配的变量
|
||||
* @param bool $merge 合并额外变量
|
||||
* @return array
|
||||
*/
|
||||
private static function parseRule($rule, $route, $pathinfo, $matches, $merge = false)
|
||||
@@ -1180,8 +1180,8 @@ class Route
|
||||
/**
|
||||
* 解析URL地址中的参数Request对象
|
||||
* @access private
|
||||
* @param string $rule 路由规则
|
||||
* @param array $var 变量
|
||||
* @param string $rule 路由规则
|
||||
* @param array $var 变量
|
||||
* @return void
|
||||
*/
|
||||
private static function parseUrlParams($url, $var = [])
|
||||
|
||||
@@ -103,9 +103,9 @@ class Session
|
||||
|
||||
/**
|
||||
* session设置
|
||||
* @param string $name session名称
|
||||
* @param mixed $value session值
|
||||
* @param string|null $prefix 作用域(前缀)
|
||||
* @param string $name session名称
|
||||
* @param mixed $value session值
|
||||
* @param string|null $prefix 作用域(前缀)
|
||||
* @return void
|
||||
*/
|
||||
public static function set($name, $value = '', $prefix = null)
|
||||
@@ -129,8 +129,8 @@ class Session
|
||||
|
||||
/**
|
||||
* session获取
|
||||
* @param string $name session名称
|
||||
* @param string|null $prefix 作用域(前缀)
|
||||
* @param string $name session名称
|
||||
* @param string|null $prefix 作用域(前缀)
|
||||
* @return mixed
|
||||
*/
|
||||
public static function get($name = '', $prefix = null)
|
||||
@@ -161,8 +161,8 @@ class Session
|
||||
|
||||
/**
|
||||
* 删除session数据
|
||||
* @param string $name session名称
|
||||
* @param string|null $prefix 作用域(前缀)
|
||||
* @param string $name session名称
|
||||
* @param string|null $prefix 作用域(前缀)
|
||||
* @return void
|
||||
*/
|
||||
public static function delete($name, $prefix = null)
|
||||
@@ -187,7 +187,7 @@ class Session
|
||||
|
||||
/**
|
||||
* 清空session数据
|
||||
* @param string|null $prefix 作用域(前缀)
|
||||
* @param string|null $prefix 作用域(前缀)
|
||||
* @return void
|
||||
*/
|
||||
public static function clear($prefix = null)
|
||||
@@ -203,8 +203,8 @@ class Session
|
||||
|
||||
/**
|
||||
* 判断session数据
|
||||
* @param string $name session名称
|
||||
* @param string|null $prefix
|
||||
* @param string $name session名称
|
||||
* @param string|null $prefix
|
||||
* @return bool
|
||||
*/
|
||||
public static function has($name, $prefix = null)
|
||||
|
||||
@@ -157,9 +157,9 @@ class Template
|
||||
/**
|
||||
* 渲染模板文件
|
||||
* @access public
|
||||
* @param string $template 模板文件
|
||||
* @param array $vars 模板变量
|
||||
* @param array $config 模板参数
|
||||
* @param string $template 模板文件
|
||||
* @param array $vars 模板变量
|
||||
* @param array $config 模板参数
|
||||
* @return void
|
||||
*/
|
||||
public function fetch($template, $vars = [], $config = [])
|
||||
@@ -204,9 +204,9 @@ class Template
|
||||
/**
|
||||
* 渲染模板内容
|
||||
* @access public
|
||||
* @param string $content 模板内容
|
||||
* @param array $vars 模板变量
|
||||
* @param array $config 模板参数
|
||||
* @param string $content 模板内容
|
||||
* @param array $vars 模板变量
|
||||
* @param array $config 模板参数
|
||||
* @return void
|
||||
*/
|
||||
public function display($content, $vars = [], $config = [])
|
||||
@@ -229,8 +229,8 @@ class Template
|
||||
/**
|
||||
* 设置布局
|
||||
* @access public
|
||||
* @param mixed $name 布局模板名称 false 则关闭布局
|
||||
* @param string $replace 布局模板内容替换标识
|
||||
* @param mixed $name 布局模板名称 false 则关闭布局
|
||||
* @param string $replace 布局模板内容替换标识
|
||||
* @return object
|
||||
*/
|
||||
public function layout($name, $replace = '')
|
||||
@@ -311,8 +311,8 @@ class Template
|
||||
/**
|
||||
* 编译模板文件内容
|
||||
* @access private
|
||||
* @param string $content 模板内容
|
||||
* @param string $cacheFile 缓存文件名
|
||||
* @param string $content 模板内容
|
||||
* @param string $cacheFile 缓存文件名
|
||||
* @return void
|
||||
*/
|
||||
private function compiler(&$content, $cacheFile)
|
||||
@@ -570,8 +570,8 @@ class Template
|
||||
/**
|
||||
* 替换页面中的literal标签
|
||||
* @access private
|
||||
* @param string $content 模板内容
|
||||
* @param boolean $restore 是否为还原
|
||||
* @param string $content 模板内容
|
||||
* @param boolean $restore 是否为还原
|
||||
* @return void
|
||||
*/
|
||||
private function parseLiteral(&$content, $restore = false)
|
||||
@@ -602,8 +602,8 @@ class Template
|
||||
/**
|
||||
* 获取模板中的block标签
|
||||
* @access private
|
||||
* @param string $content 模板内容
|
||||
* @param boolean $sort 是否排序
|
||||
* @param string $content 模板内容
|
||||
* @param boolean $sort 是否排序
|
||||
* @return array
|
||||
*/
|
||||
private function parseBlock(&$content, $sort = false)
|
||||
@@ -665,9 +665,9 @@ class Template
|
||||
/**
|
||||
* TagLib库解析
|
||||
* @access public
|
||||
* @param string $tagLib 要解析的标签库
|
||||
* @param string $content 要解析的模板内容
|
||||
* @param boolean $hide 是否隐藏标签库前缀
|
||||
* @param string $tagLib 要解析的标签库
|
||||
* @param string $content 要解析的模板内容
|
||||
* @param boolean $hide 是否隐藏标签库前缀
|
||||
* @return void
|
||||
*/
|
||||
public function parseTagLib($tagLib, &$content, $hide = false)
|
||||
@@ -687,8 +687,8 @@ class Template
|
||||
/**
|
||||
* 分析标签属性
|
||||
* @access public
|
||||
* @param string $str 属性字符串
|
||||
* @param string $name 不为空时返回指定的属性名
|
||||
* @param string $str 属性字符串
|
||||
* @param string $name 不为空时返回指定的属性名
|
||||
* @return array
|
||||
*/
|
||||
public function parseAttr($str, $name = null)
|
||||
|
||||
@@ -21,13 +21,13 @@ class Url
|
||||
{
|
||||
/**
|
||||
* URL生成 支持路由反射
|
||||
* @param string $url URL表达式,
|
||||
* @param string $url URL表达式,
|
||||
* 格式:'[模块/控制器/操作]?参数1=值1&参数2=值2...@域名'
|
||||
* @控制器/操作?参数1=值1&参数2=值2...
|
||||
* \\命名空间类\\方法?参数1=值1&参数2=值2...
|
||||
* @param string|array $vars 传入的参数,支持数组和字符串
|
||||
* @param string|bool $suffix 伪静态后缀,默认为true表示获取配置值
|
||||
* @param boolean|string $domain 是否显示域名 或者直接传入域名
|
||||
* @param string|array $vars 传入的参数,支持数组和字符串
|
||||
* @param string|bool $suffix 伪静态后缀,默认为true表示获取配置值
|
||||
* @param boolean|string $domain 是否显示域名 或者直接传入域名
|
||||
* @return string
|
||||
*/
|
||||
public static function build($url = '', $vars = '', $suffix = true, $domain = false)
|
||||
|
||||
@@ -108,8 +108,8 @@ class Validate
|
||||
/**
|
||||
* 实例化验证
|
||||
* @access public
|
||||
* @param array $rules 验证规则
|
||||
* @param array $message 验证提示信息
|
||||
* @param array $rules 验证规则
|
||||
* @param array $message 验证提示信息
|
||||
* @return Validate
|
||||
*/
|
||||
public static function make($rules = [], $message = [])
|
||||
@@ -123,8 +123,8 @@ class Validate
|
||||
/**
|
||||
* 添加字段验证规则
|
||||
* @access protected
|
||||
* @param string|array $name 字段名称或者规则数组
|
||||
* @param mixed $rule 验证规则
|
||||
* @param string|array $name 字段名称或者规则数组
|
||||
* @param mixed $rule 验证规则
|
||||
* @return Validate
|
||||
*/
|
||||
public function rule($name, $rule = '')
|
||||
@@ -140,8 +140,8 @@ class Validate
|
||||
/**
|
||||
* 注册验证(类型)规则
|
||||
* @access public
|
||||
* @param string $type 验证规则类型
|
||||
* @param mixed $callback callback方法(或闭包)
|
||||
* @param string $type 验证规则类型
|
||||
* @param mixed $callback callback方法(或闭包)
|
||||
* @return void
|
||||
*/
|
||||
public static function extend($type, $callback = null)
|
||||
@@ -156,8 +156,8 @@ class Validate
|
||||
/**
|
||||
* 获取验证规则的默认提示信息
|
||||
* @access protected
|
||||
* @param string|array $type 验证规则类型名称或者数组
|
||||
* @param string $msg 验证提示信息
|
||||
* @param string|array $type 验证规则类型名称或者数组
|
||||
* @param string $msg 验证提示信息
|
||||
* @return void
|
||||
*/
|
||||
public static function setTypeMsg($type, $msg = null)
|
||||
@@ -172,8 +172,8 @@ class Validate
|
||||
/**
|
||||
* 设置提示信息
|
||||
* @access public
|
||||
* @param string|array $name 字段名称
|
||||
* @param string $message 提示信息
|
||||
* @param string|array $name 字段名称
|
||||
* @param string $message 提示信息
|
||||
* @return Validate
|
||||
*/
|
||||
public function message($name, $message = '')
|
||||
@@ -189,8 +189,8 @@ class Validate
|
||||
/**
|
||||
* 设置验证场景
|
||||
* @access public
|
||||
* @param string|array $name 场景名或者场景设置数组
|
||||
* @param mixed $fields 要验证的字段
|
||||
* @param string|array $name 场景名或者场景设置数组
|
||||
* @param mixed $fields 要验证的字段
|
||||
* @return Validate
|
||||
*/
|
||||
public function scene($name, $fields = null)
|
||||
@@ -222,9 +222,9 @@ class Validate
|
||||
/**
|
||||
* 数据自动验证
|
||||
* @access public
|
||||
* @param array $data 数据
|
||||
* @param mixed $rules 验证规则
|
||||
* @param string $scene 验证场景
|
||||
* @param array $data 数据
|
||||
* @param mixed $rules 验证规则
|
||||
* @param string $scene 验证场景
|
||||
* @return bool
|
||||
*/
|
||||
public function check($data, $rules = [], $scene = '')
|
||||
@@ -315,12 +315,12 @@ class Validate
|
||||
/**
|
||||
* 验证单个字段规则
|
||||
* @access protected
|
||||
* @param string $field 字段名
|
||||
* @param mixed $value 字段值
|
||||
* @param mixed $rules 验证规则
|
||||
* @param array $data 数据
|
||||
* @param string $title 字段描述
|
||||
* @param array $msg 提示信息
|
||||
* @param string $field 字段名
|
||||
* @param mixed $value 字段值
|
||||
* @param mixed $rules 验证规则
|
||||
* @param array $data 数据
|
||||
* @param string $title 字段描述
|
||||
* @param array $msg 提示信息
|
||||
* @return mixed
|
||||
*/
|
||||
protected function checkItem($field, $value, $rules, $data, $title = '', $msg = [])
|
||||
@@ -385,9 +385,9 @@ class Validate
|
||||
/**
|
||||
* 验证表单令牌(需要配置令牌生成行为)
|
||||
* @access protected
|
||||
* @param mixed $value 字段值
|
||||
* @param mixed $rule 验证规则
|
||||
* @param array $data 数据
|
||||
* @param mixed $value 字段值
|
||||
* @param mixed $rule 验证规则
|
||||
* @param array $data 数据
|
||||
* @return bool
|
||||
*/
|
||||
protected function token($value, $rule, $data)
|
||||
@@ -412,9 +412,9 @@ class Validate
|
||||
/**
|
||||
* 验证是否和某个字段的值一致
|
||||
* @access protected
|
||||
* @param mixed $value 字段值
|
||||
* @param mixed $rule 验证规则
|
||||
* @param array $data 数据
|
||||
* @param mixed $value 字段值
|
||||
* @param mixed $rule 验证规则
|
||||
* @param array $data 数据
|
||||
* @return bool
|
||||
*/
|
||||
protected function confirm($value, $rule, $data)
|
||||
@@ -425,8 +425,8 @@ class Validate
|
||||
/**
|
||||
* 验证是否大于等于某个值
|
||||
* @access protected
|
||||
* @param mixed $value 字段值
|
||||
* @param mixed $rule 验证规则
|
||||
* @param mixed $value 字段值
|
||||
* @param mixed $rule 验证规则
|
||||
* @return bool
|
||||
*/
|
||||
protected function egt($value, $rule)
|
||||
@@ -437,8 +437,8 @@ class Validate
|
||||
/**
|
||||
* 验证是否大于某个值
|
||||
* @access protected
|
||||
* @param mixed $value 字段值
|
||||
* @param mixed $rule 验证规则
|
||||
* @param mixed $value 字段值
|
||||
* @param mixed $rule 验证规则
|
||||
* @return bool
|
||||
*/
|
||||
protected function gt($value, $rule)
|
||||
@@ -449,8 +449,8 @@ class Validate
|
||||
/**
|
||||
* 验证是否小于等于某个值
|
||||
* @access protected
|
||||
* @param mixed $value 字段值
|
||||
* @param mixed $rule 验证规则
|
||||
* @param mixed $value 字段值
|
||||
* @param mixed $rule 验证规则
|
||||
* @return bool
|
||||
*/
|
||||
protected function elt($value, $rule)
|
||||
@@ -461,8 +461,8 @@ class Validate
|
||||
/**
|
||||
* 验证是否小于某个值
|
||||
* @access protected
|
||||
* @param mixed $value 字段值
|
||||
* @param mixed $rule 验证规则
|
||||
* @param mixed $value 字段值
|
||||
* @param mixed $rule 验证规则
|
||||
* @return bool
|
||||
*/
|
||||
protected function lt($value, $rule)
|
||||
@@ -473,8 +473,8 @@ class Validate
|
||||
/**
|
||||
* 验证是否等于某个值
|
||||
* @access protected
|
||||
* @param mixed $value 字段值
|
||||
* @param mixed $rule 验证规则
|
||||
* @param mixed $value 字段值
|
||||
* @param mixed $rule 验证规则
|
||||
* @return bool
|
||||
*/
|
||||
protected function eq($value, $rule)
|
||||
@@ -485,8 +485,8 @@ class Validate
|
||||
/**
|
||||
* 验证字段值是否为有效格式
|
||||
* @access protected
|
||||
* @param mixed $value 字段值
|
||||
* @param string $rule 验证规则
|
||||
* @param mixed $value 字段值
|
||||
* @param string $rule 验证规则
|
||||
* @return bool
|
||||
*/
|
||||
protected function is($value, $rule)
|
||||
@@ -568,8 +568,8 @@ class Validate
|
||||
/**
|
||||
* 验证是否为合格的域名或者IP 支持A,MX,NS,SOA,PTR,CNAME,AAAA,A6, SRV,NAPTR,TXT 或者 ANY类型
|
||||
* @access protected
|
||||
* @param mixed $value 字段值
|
||||
* @param mixed $rule 验证规则
|
||||
* @param mixed $value 字段值
|
||||
* @param mixed $rule 验证规则
|
||||
* @return bool
|
||||
*/
|
||||
protected function activeUrl($value, $rule)
|
||||
@@ -580,8 +580,8 @@ class Validate
|
||||
/**
|
||||
* 验证是否有效IP
|
||||
* @access protected
|
||||
* @param mixed $value 字段值
|
||||
* @param mixed $rule 验证规则 ipv4 ipv6
|
||||
* @param mixed $value 字段值
|
||||
* @param mixed $rule 验证规则 ipv4 ipv6
|
||||
* @return bool
|
||||
*/
|
||||
protected function ip($value, $rule)
|
||||
@@ -595,8 +595,8 @@ class Validate
|
||||
/**
|
||||
* 验证上传文件后缀
|
||||
* @access protected
|
||||
* @param mixed $value 字段值
|
||||
* @param mixed $rule 验证规则
|
||||
* @param mixed $value 字段值
|
||||
* @param mixed $rule 验证规则
|
||||
* @return bool
|
||||
*/
|
||||
protected function fileExt($value, $rule)
|
||||
@@ -623,8 +623,8 @@ class Validate
|
||||
/**
|
||||
* 验证上传文件类型
|
||||
* @access protected
|
||||
* @param mixed $value 字段值
|
||||
* @param mixed $rule 验证规则
|
||||
* @param mixed $value 字段值
|
||||
* @param mixed $rule 验证规则
|
||||
* @return bool
|
||||
*/
|
||||
protected function fileMime($value, $rule)
|
||||
@@ -651,8 +651,8 @@ class Validate
|
||||
/**
|
||||
* 验证上传文件大小
|
||||
* @access protected
|
||||
* @param mixed $value 字段值
|
||||
* @param mixed $rule 验证规则
|
||||
* @param mixed $value 字段值
|
||||
* @param mixed $rule 验证规则
|
||||
* @return bool
|
||||
*/
|
||||
protected function fileSize($value, $rule)
|
||||
@@ -679,8 +679,8 @@ class Validate
|
||||
/**
|
||||
* 验证请求类型
|
||||
* @access protected
|
||||
* @param mixed $value 字段值
|
||||
* @param mixed $rule 验证规则
|
||||
* @param mixed $value 字段值
|
||||
* @param mixed $rule 验证规则
|
||||
* @return bool
|
||||
*/
|
||||
protected function method($value, $rule)
|
||||
@@ -692,8 +692,8 @@ class Validate
|
||||
/**
|
||||
* 验证时间和日期是否符合指定格式
|
||||
* @access protected
|
||||
* @param mixed $value 字段值
|
||||
* @param mixed $rule 验证规则
|
||||
* @param mixed $value 字段值
|
||||
* @param mixed $rule 验证规则
|
||||
* @return bool
|
||||
*/
|
||||
protected function dateFormat($value, $rule)
|
||||
@@ -705,10 +705,10 @@ class Validate
|
||||
/**
|
||||
* 验证是否唯一
|
||||
* @access protected
|
||||
* @param mixed $value 字段值
|
||||
* @param mixed $rule 验证规则 格式:数据表,字段名,排除ID,主键名
|
||||
* @param array $data 数据
|
||||
* @param string $field 验证字段名
|
||||
* @param mixed $value 字段值
|
||||
* @param mixed $rule 验证规则 格式:数据表,字段名,排除ID,主键名
|
||||
* @param array $data 数据
|
||||
* @param string $field 验证字段名
|
||||
* @return bool
|
||||
*/
|
||||
protected function unique($value, $rule, $data, $field)
|
||||
@@ -747,9 +747,9 @@ class Validate
|
||||
/**
|
||||
* 使用行为类验证
|
||||
* @access protected
|
||||
* @param mixed $value 字段值
|
||||
* @param mixed $rule 验证规则
|
||||
* @param array $data 数据
|
||||
* @param mixed $value 字段值
|
||||
* @param mixed $rule 验证规则
|
||||
* @param array $data 数据
|
||||
* @return mixed
|
||||
*/
|
||||
protected function behavior($value, $rule, $data)
|
||||
@@ -760,8 +760,8 @@ class Validate
|
||||
/**
|
||||
* 使用filter_var方式验证
|
||||
* @access protected
|
||||
* @param mixed $value 字段值
|
||||
* @param mixed $rule 验证规则
|
||||
* @param mixed $value 字段值
|
||||
* @param mixed $rule 验证规则
|
||||
* @return bool
|
||||
*/
|
||||
protected function filter($value, $rule)
|
||||
@@ -779,9 +779,9 @@ class Validate
|
||||
/**
|
||||
* 验证某个字段等于某个值的时候必须
|
||||
* @access protected
|
||||
* @param mixed $value 字段值
|
||||
* @param mixed $rule 验证规则
|
||||
* @param array $data 数据
|
||||
* @param mixed $value 字段值
|
||||
* @param mixed $rule 验证规则
|
||||
* @param array $data 数据
|
||||
* @return bool
|
||||
*/
|
||||
protected function requireIf($value, $rule, $data)
|
||||
@@ -797,9 +797,9 @@ class Validate
|
||||
/**
|
||||
* 通过回调方法验证某个字段是否必须
|
||||
* @access protected
|
||||
* @param mixed $value 字段值
|
||||
* @param mixed $rule 验证规则
|
||||
* @param array $data 数据
|
||||
* @param mixed $value 字段值
|
||||
* @param mixed $rule 验证规则
|
||||
* @param array $data 数据
|
||||
* @return bool
|
||||
*/
|
||||
protected function requireCallback($value, $rule, $data)
|
||||
@@ -815,9 +815,9 @@ class Validate
|
||||
/**
|
||||
* 验证某个字段有值的情况下必须
|
||||
* @access protected
|
||||
* @param mixed $value 字段值
|
||||
* @param mixed $rule 验证规则
|
||||
* @param array $data 数据
|
||||
* @param mixed $value 字段值
|
||||
* @param mixed $rule 验证规则
|
||||
* @param array $data 数据
|
||||
* @return bool
|
||||
*/
|
||||
protected function requireWith($value, $rule, $data)
|
||||
@@ -833,8 +833,8 @@ class Validate
|
||||
/**
|
||||
* 验证是否在范围内
|
||||
* @access protected
|
||||
* @param mixed $value 字段值
|
||||
* @param mixed $rule 验证规则
|
||||
* @param mixed $value 字段值
|
||||
* @param mixed $rule 验证规则
|
||||
* @return bool
|
||||
*/
|
||||
protected function in($value, $rule)
|
||||
@@ -845,8 +845,8 @@ class Validate
|
||||
/**
|
||||
* 验证是否不在某个范围
|
||||
* @access protected
|
||||
* @param mixed $value 字段值
|
||||
* @param mixed $rule 验证规则
|
||||
* @param mixed $value 字段值
|
||||
* @param mixed $rule 验证规则
|
||||
* @return bool
|
||||
*/
|
||||
protected function notIn($value, $rule)
|
||||
@@ -857,8 +857,8 @@ class Validate
|
||||
/**
|
||||
* between验证数据
|
||||
* @access protected
|
||||
* @param mixed $value 字段值
|
||||
* @param mixed $rule 验证规则
|
||||
* @param mixed $value 字段值
|
||||
* @param mixed $rule 验证规则
|
||||
* @return bool
|
||||
*/
|
||||
protected function between($value, $rule)
|
||||
@@ -873,8 +873,8 @@ class Validate
|
||||
/**
|
||||
* 使用notbetween验证数据
|
||||
* @access protected
|
||||
* @param mixed $value 字段值
|
||||
* @param mixed $rule 验证规则
|
||||
* @param mixed $value 字段值
|
||||
* @param mixed $rule 验证规则
|
||||
* @return bool
|
||||
*/
|
||||
protected function notBetween($value, $rule)
|
||||
@@ -889,8 +889,8 @@ class Validate
|
||||
/**
|
||||
* 验证数据长度
|
||||
* @access protected
|
||||
* @param mixed $value 字段值
|
||||
* @param mixed $rule 验证规则
|
||||
* @param mixed $value 字段值
|
||||
* @param mixed $rule 验证规则
|
||||
* @return bool
|
||||
*/
|
||||
protected function length($value, $rule)
|
||||
@@ -909,8 +909,8 @@ class Validate
|
||||
/**
|
||||
* 验证数据最大长度
|
||||
* @access protected
|
||||
* @param mixed $value 字段值
|
||||
* @param mixed $rule 验证规则
|
||||
* @param mixed $value 字段值
|
||||
* @param mixed $rule 验证规则
|
||||
* @return bool
|
||||
*/
|
||||
protected function max($value, $rule)
|
||||
@@ -922,8 +922,8 @@ class Validate
|
||||
/**
|
||||
* 验证数据最小长度
|
||||
* @access protected
|
||||
* @param mixed $value 字段值
|
||||
* @param mixed $rule 验证规则
|
||||
* @param mixed $value 字段值
|
||||
* @param mixed $rule 验证规则
|
||||
* @return bool
|
||||
*/
|
||||
protected function min($value, $rule)
|
||||
@@ -935,8 +935,8 @@ class Validate
|
||||
/**
|
||||
* 验证日期
|
||||
* @access protected
|
||||
* @param mixed $value 字段值
|
||||
* @param mixed $rule 验证规则
|
||||
* @param mixed $value 字段值
|
||||
* @param mixed $rule 验证规则
|
||||
* @return bool
|
||||
*/
|
||||
protected function after($value, $rule)
|
||||
@@ -947,8 +947,8 @@ class Validate
|
||||
/**
|
||||
* 验证日期
|
||||
* @access protected
|
||||
* @param mixed $value 字段值
|
||||
* @param mixed $rule 验证规则
|
||||
* @param mixed $value 字段值
|
||||
* @param mixed $rule 验证规则
|
||||
* @return bool
|
||||
*/
|
||||
protected function before($value, $rule)
|
||||
@@ -959,8 +959,8 @@ class Validate
|
||||
/**
|
||||
* 验证有效期
|
||||
* @access protected
|
||||
* @param mixed $value 字段值
|
||||
* @param mixed $rule 验证规则
|
||||
* @param mixed $value 字段值
|
||||
* @param mixed $rule 验证规则
|
||||
* @return bool
|
||||
*/
|
||||
protected function expire($value, $rule)
|
||||
@@ -982,8 +982,8 @@ class Validate
|
||||
/**
|
||||
* 验证IP许可
|
||||
* @access protected
|
||||
* @param string $value 字段值
|
||||
* @param mixed $rule 验证规则
|
||||
* @param string $value 字段值
|
||||
* @param mixed $rule 验证规则
|
||||
* @return mixed
|
||||
*/
|
||||
protected function allowIp($value, $rule)
|
||||
@@ -994,8 +994,8 @@ class Validate
|
||||
/**
|
||||
* 验证IP禁用
|
||||
* @access protected
|
||||
* @param string $value 字段值
|
||||
* @param mixed $rule 验证规则
|
||||
* @param string $value 字段值
|
||||
* @param mixed $rule 验证规则
|
||||
* @return mixed
|
||||
*/
|
||||
protected function denyIp($value, $rule)
|
||||
@@ -1006,8 +1006,8 @@ class Validate
|
||||
/**
|
||||
* 使用正则验证数据
|
||||
* @access protected
|
||||
* @param mixed $value 字段值
|
||||
* @param mixed $rule 验证规则 正则规则或者预定义正则名
|
||||
* @param mixed $value 字段值
|
||||
* @param mixed $rule 验证规则 正则规则或者预定义正则名
|
||||
* @return mixed
|
||||
*/
|
||||
protected function regex($value, $rule)
|
||||
@@ -1031,8 +1031,8 @@ class Validate
|
||||
/**
|
||||
* 获取数据值
|
||||
* @access protected
|
||||
* @param array $data 数据
|
||||
* @param string $key 数据标识 支持二维
|
||||
* @param array $data 数据
|
||||
* @param string $key 数据标识 支持二维
|
||||
* @return mixed
|
||||
*/
|
||||
protected function getDataValue($data, $key)
|
||||
@@ -1050,10 +1050,10 @@ class Validate
|
||||
/**
|
||||
* 获取验证规则的错误提示信息
|
||||
* @access protected
|
||||
* @param string $attribute 字段英文名
|
||||
* @param string $title 字段描述名
|
||||
* @param string $type 验证规则名称
|
||||
* @param mixed $rule 验证规则数据
|
||||
* @param string $attribute 字段英文名
|
||||
* @param string $title 字段描述名
|
||||
* @param string $type 验证规则名称
|
||||
* @param mixed $rule 验证规则数据
|
||||
* @return string
|
||||
*/
|
||||
protected function getRuleMsg($attribute, $title, $type, $rule)
|
||||
|
||||
@@ -93,11 +93,11 @@ class View
|
||||
|
||||
/**
|
||||
* 解析和获取模板内容 用于输出
|
||||
* @param string $template 模板文件名或者内容
|
||||
* @param array $vars 模板输出变量
|
||||
* @param array $replace 替换内容
|
||||
* @param array $config 模板参数
|
||||
* @param bool $renderContent 是否渲染内容
|
||||
* @param string $template 模板文件名或者内容
|
||||
* @param array $vars 模板输出变量
|
||||
* @param array $replace 替换内容
|
||||
* @param array $config 模板参数
|
||||
* @param bool $renderContent 是否渲染内容
|
||||
* @return string
|
||||
* @throws Exception
|
||||
*/
|
||||
@@ -129,8 +129,8 @@ class View
|
||||
/**
|
||||
* 视图内容替换
|
||||
* @access public
|
||||
* @param string|array $content 被替换内容(支持批量替换)
|
||||
* @param string $replace 替换内容
|
||||
* @param string|array $content 被替换内容(支持批量替换)
|
||||
* @param string $replace 替换内容
|
||||
* @return $this
|
||||
*/
|
||||
public function replace($content, $replace = '')
|
||||
@@ -160,8 +160,8 @@ class View
|
||||
/**
|
||||
* 模板变量赋值
|
||||
* @access public
|
||||
* @param string $name 变量名
|
||||
* @param mixed $value 变量值
|
||||
* @param string $name 变量名
|
||||
* @param mixed $value 变量值
|
||||
*/
|
||||
public function __set($name, $value)
|
||||
{
|
||||
|
||||
6
library/think/cache/driver/Apc.php
vendored
6
library/think/cache/driver/Apc.php
vendored
@@ -57,9 +57,9 @@ class Apc
|
||||
/**
|
||||
* 写入缓存
|
||||
* @access public
|
||||
* @param string $name 缓存变量名
|
||||
* @param mixed $value 存储数据
|
||||
* @param integer $expire 有效时间(秒)
|
||||
* @param string $name 缓存变量名
|
||||
* @param mixed $value 存储数据
|
||||
* @param integer $expire 有效时间(秒)
|
||||
* @return bool
|
||||
*/
|
||||
public function set($name, $value, $expire = null)
|
||||
|
||||
6
library/think/cache/driver/File.php
vendored
6
library/think/cache/driver/File.php
vendored
@@ -121,9 +121,9 @@ class File
|
||||
/**
|
||||
* 写入缓存
|
||||
* @access public
|
||||
* @param string $name 缓存变量名
|
||||
* @param mixed $value 存储数据
|
||||
* @param int $expire 有效时间 0为永久
|
||||
* @param string $name 缓存变量名
|
||||
* @param mixed $value 存储数据
|
||||
* @param int $expire 有效时间 0为永久
|
||||
* @return boolean
|
||||
*/
|
||||
public function set($name, $value, $expire = null)
|
||||
|
||||
6
library/think/cache/driver/Lite.php
vendored
6
library/think/cache/driver/Lite.php
vendored
@@ -79,9 +79,9 @@ class Lite
|
||||
/**
|
||||
* 写入缓存
|
||||
* @access public
|
||||
* @param string $name 缓存变量名
|
||||
* @param mixed $value 存储数据
|
||||
* @internal param int $expire 有效时间 0为永久
|
||||
* @param string $name 缓存变量名
|
||||
* @param mixed $value 存储数据
|
||||
* @param int $expire 有效时间 0为永久
|
||||
* @return bool
|
||||
*/
|
||||
public function set($name, $value, $expire = null)
|
||||
|
||||
6
library/think/cache/driver/Memcache.php
vendored
6
library/think/cache/driver/Memcache.php
vendored
@@ -70,9 +70,9 @@ class Memcache
|
||||
/**
|
||||
* 写入缓存
|
||||
* @access public
|
||||
* @param string $name 缓存变量名
|
||||
* @param mixed $value 存储数据
|
||||
* @param integer $expire 有效时间(秒)
|
||||
* @param string $name 缓存变量名
|
||||
* @param mixed $value 存储数据
|
||||
* @param integer $expire 有效时间(秒)
|
||||
* @return bool
|
||||
*/
|
||||
public function set($name, $value, $expire = null)
|
||||
|
||||
6
library/think/cache/driver/Memcached.php
vendored
6
library/think/cache/driver/Memcached.php
vendored
@@ -71,9 +71,9 @@ class Memcached
|
||||
/**
|
||||
* 写入缓存
|
||||
* @access public
|
||||
* @param string $name 缓存变量名
|
||||
* @param mixed $value 存储数据
|
||||
* @param integer $expire 有效时间(秒)
|
||||
* @param string $name 缓存变量名
|
||||
* @param mixed $value 存储数据
|
||||
* @param integer $expire 有效时间(秒)
|
||||
* @return bool
|
||||
*/
|
||||
public function set($name, $value, $expire = null)
|
||||
|
||||
6
library/think/cache/driver/Redis.php
vendored
6
library/think/cache/driver/Redis.php
vendored
@@ -73,9 +73,9 @@ class Redis
|
||||
/**
|
||||
* 写入缓存
|
||||
* @access public
|
||||
* @param string $name 缓存变量名
|
||||
* @param mixed $value 存储数据
|
||||
* @param integer $expire 有效时间(秒)
|
||||
* @param string $name 缓存变量名
|
||||
* @param mixed $value 存储数据
|
||||
* @param integer $expire 有效时间(秒)
|
||||
* @return boolean
|
||||
*/
|
||||
public function set($name, $value, $expire = null)
|
||||
|
||||
6
library/think/cache/driver/Sae.php
vendored
6
library/think/cache/driver/Sae.php
vendored
@@ -63,9 +63,9 @@ class Sae
|
||||
/**
|
||||
* 写入缓存
|
||||
* @access public
|
||||
* @param string $name 缓存变量名
|
||||
* @param mixed $value 存储数据
|
||||
* @param integer $expire 有效时间(秒)
|
||||
* @param string $name 缓存变量名
|
||||
* @param mixed $value 存储数据
|
||||
* @param integer $expire 有效时间(秒)
|
||||
* @return bool
|
||||
*/
|
||||
public function set($name, $value, $expire = null)
|
||||
|
||||
6
library/think/cache/driver/Secache.php
vendored
6
library/think/cache/driver/Secache.php
vendored
@@ -62,9 +62,9 @@ class Secache
|
||||
/**
|
||||
* 写入缓存
|
||||
* @access public
|
||||
* @param string $name 缓存变量名
|
||||
* @param mixed $value 存储数据
|
||||
* @param integer $expire 有效时间(秒)
|
||||
* @param string $name 缓存变量名
|
||||
* @param mixed $value 存储数据
|
||||
* @param integer $expire 有效时间(秒)
|
||||
* @return boolean
|
||||
*/
|
||||
public function set($name, $value)
|
||||
|
||||
6
library/think/cache/driver/Sqlite.php
vendored
6
library/think/cache/driver/Sqlite.php
vendored
@@ -72,9 +72,9 @@ class Sqlite implements CacheInterface
|
||||
/**
|
||||
* 写入缓存
|
||||
* @access public
|
||||
* @param string $name 缓存变量名
|
||||
* @param mixed $value 存储数据
|
||||
* @param integer $expire 有效时间(秒)
|
||||
* @param string $name 缓存变量名
|
||||
* @param mixed $value 存储数据
|
||||
* @param integer $expire 有效时间(秒)
|
||||
* @return boolean
|
||||
*/
|
||||
public function set($name, $value, $expire = null)
|
||||
|
||||
6
library/think/cache/driver/Test.php
vendored
6
library/think/cache/driver/Test.php
vendored
@@ -34,9 +34,9 @@ class Test
|
||||
/**
|
||||
* 写入缓存
|
||||
* @access public
|
||||
* @param string $name 缓存变量名
|
||||
* @param mixed $value 存储数据
|
||||
* @param int $expire 有效时间 0为永久
|
||||
* @param string $name 缓存变量名
|
||||
* @param mixed $value 存储数据
|
||||
* @param int $expire 有效时间 0为永久
|
||||
* @return boolean
|
||||
*/
|
||||
public function set($name, $value, $expire = null)
|
||||
|
||||
6
library/think/cache/driver/Wincache.php
vendored
6
library/think/cache/driver/Wincache.php
vendored
@@ -56,9 +56,9 @@ class Wincache
|
||||
/**
|
||||
* 写入缓存
|
||||
* @access public
|
||||
* @param string $name 缓存变量名
|
||||
* @param mixed $value 存储数据
|
||||
* @param integer $expire 有效时间(秒)
|
||||
* @param string $name 缓存变量名
|
||||
* @param mixed $value 存储数据
|
||||
* @param integer $expire 有效时间(秒)
|
||||
* @return boolean
|
||||
*/
|
||||
public function set($name, $value, $expire = null)
|
||||
|
||||
6
library/think/cache/driver/Xcache.php
vendored
6
library/think/cache/driver/Xcache.php
vendored
@@ -59,9 +59,9 @@ class Xcache
|
||||
/**
|
||||
* 写入缓存
|
||||
* @access public
|
||||
* @param string $name 缓存变量名
|
||||
* @param mixed $value 存储数据
|
||||
* @param integer $expire 有效时间(秒)
|
||||
* @param string $name 缓存变量名
|
||||
* @param mixed $value 存储数据
|
||||
* @param integer $expire 有效时间(秒)
|
||||
* @return boolean
|
||||
*/
|
||||
public function set($name, $value, $expire = null)
|
||||
|
||||
@@ -12,7 +12,7 @@
|
||||
namespace think\controller;
|
||||
|
||||
use think\App;
|
||||
|
||||
use think\Loader;
|
||||
/**
|
||||
* ThinkPHP Hprose控制器类
|
||||
*/
|
||||
@@ -37,14 +37,14 @@ abstract class Hprose
|
||||
}
|
||||
|
||||
//导入类库
|
||||
\think\Loader::import('vendor.Hprose.HproseHttpServer');
|
||||
Loader::import('vendor.Hprose.HproseHttpServer');
|
||||
//实例化HproseHttpServer
|
||||
$server = new \HproseHttpServer();
|
||||
if ($this->allowMethodList) {
|
||||
$methods = $this->allowMethodList;
|
||||
} else {
|
||||
$methods = get_class_methods($this);
|
||||
$methods = array_diff($methods, array('__construct', '__call', '_initialize'));
|
||||
$methods = array_diff($methods, ['__construct', '__call', '_initialize']);
|
||||
}
|
||||
$server->addMethods($methods, $this);
|
||||
if (App::$debug || $this->debug) {
|
||||
|
||||
@@ -11,6 +11,7 @@
|
||||
|
||||
namespace think\controller;
|
||||
|
||||
use think\Loader;
|
||||
/**
|
||||
* ThinkPHP JsonRPC控制器类
|
||||
*/
|
||||
@@ -29,7 +30,7 @@ abstract class Jsonrpc
|
||||
}
|
||||
|
||||
//导入类库
|
||||
\think\Loader::import('vendor.jsonrpc.jsonRPCServer');
|
||||
Loader::import('vendor.jsonrpc.jsonRPCServer');
|
||||
// 启动server
|
||||
\jsonRPCServer::handle($this);
|
||||
}
|
||||
|
||||
@@ -17,8 +17,8 @@ use think\Request;
|
||||
abstract class Rest
|
||||
{
|
||||
|
||||
protected $_method = ''; // 当前请求类型
|
||||
protected $_type = ''; // 当前资源类型
|
||||
protected $method; // 当前请求类型
|
||||
protected $type; // 当前资源类型
|
||||
// 输出类型
|
||||
protected $restMethodList = 'get|post|put|delete';
|
||||
protected $restDefaultMethod = 'get';
|
||||
@@ -41,12 +41,12 @@ abstract class Rest
|
||||
$ext = $request->ext();
|
||||
if ('' == $ext) {
|
||||
// 自动检测资源类型
|
||||
$this->_type = $this->getAcceptType();
|
||||
$this->type = $request->type();
|
||||
} elseif (!preg_match('/\(' . $this->restTypeList . '\)$/i', $ext)) {
|
||||
// 资源类型非法 则用默认资源类型访问
|
||||
$this->_type = $this->restDefaultType;
|
||||
$this->type = $this->restDefaultType;
|
||||
} else {
|
||||
$this->_type = $ext;
|
||||
$this->type = $ext;
|
||||
}
|
||||
// 请求方式检测
|
||||
$method = strtolower($request->method());
|
||||
@@ -54,7 +54,7 @@ abstract class Rest
|
||||
// 请求方式非法 则用默认请求方法
|
||||
$method = $this->restDefaultMethod;
|
||||
}
|
||||
$this->_method = $method;
|
||||
$this->method = $method;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -67,13 +67,13 @@ abstract class Rest
|
||||
*/
|
||||
public function _empty($method, $args)
|
||||
{
|
||||
if (method_exists($this, $method . '_' . $this->_method . '_' . $this->_type)) {
|
||||
if (method_exists($this, $method . '_' . $this->method . '_' . $this->type)) {
|
||||
// RESTFul方法支持
|
||||
$fun = $method . '_' . $this->_method . '_' . $this->_type;
|
||||
} elseif ($this->_method == $this->restDefaultMethod && method_exists($this, $method . '_' . $this->_type)) {
|
||||
$fun = $method . '_' . $this->_type;
|
||||
} elseif ($this->_type == $this->restDefaultType && method_exists($this, $method . '_' . $this->_method)) {
|
||||
$fun = $method . '_' . $this->_method;
|
||||
$fun = $method . '_' . $this->method . '_' . $this->type;
|
||||
} elseif ($this->_method == $this->restDefaultMethod && method_exists($this, $method . '_' . $this->type)) {
|
||||
$fun = $method . '_' . $this->type;
|
||||
} elseif ($this->type == $this->restDefaultType && method_exists($this, $method . '_' . $this->method)) {
|
||||
$fun = $method . '_' . $this->method;
|
||||
}
|
||||
if (isset($fun)) {
|
||||
return $this->$fun();
|
||||
@@ -86,9 +86,9 @@ abstract class Rest
|
||||
/**
|
||||
* 输出返回数据
|
||||
* @access protected
|
||||
* @param mixed $data 要返回的数据
|
||||
* @param String $type 返回类型 JSON XML
|
||||
* @param integer $code HTTP状态
|
||||
* @param mixed $data 要返回的数据
|
||||
* @param String $type 返回类型 JSON XML
|
||||
* @param integer $code HTTP状态码
|
||||
* @return Response
|
||||
*/
|
||||
protected function response($data, $type = 'json', $code = 200)
|
||||
@@ -96,42 +96,4 @@ abstract class Rest
|
||||
return Response::create($data, $type)->code($code);
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取当前请求的Accept头信息
|
||||
* @return string
|
||||
*/
|
||||
public static function getAcceptType()
|
||||
{
|
||||
if (!isset($_SERVER['HTTP_ACCEPT'])) {
|
||||
return false;
|
||||
}
|
||||
|
||||
$type = [
|
||||
'html' => 'text/html,application/xhtml+xml,*/*',
|
||||
'xml' => 'application/xml,text/xml,application/x-xml',
|
||||
'json' => 'application/json,text/x-json,application/jsonrequest,text/json',
|
||||
'js' => 'text/javascript,application/javascript,application/x-javascript',
|
||||
'css' => 'text/css',
|
||||
'rss' => 'application/rss+xml',
|
||||
'yaml' => 'application/x-yaml,text/yaml',
|
||||
'atom' => 'application/atom+xml',
|
||||
'pdf' => 'application/pdf',
|
||||
'text' => 'text/plain',
|
||||
'png' => 'image/png',
|
||||
'jpg' => 'image/jpg,image/jpeg,image/pjpeg',
|
||||
'gif' => 'image/gif',
|
||||
'csv' => 'text/csv',
|
||||
];
|
||||
|
||||
foreach ($type as $key => $val) {
|
||||
$array = explode(',', $val);
|
||||
foreach ($array as $k => $v) {
|
||||
if (stristr($_SERVER['HTTP_ACCEPT'], $v)) {
|
||||
return $key;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -12,6 +12,7 @@
|
||||
namespace think\controller;
|
||||
|
||||
use think\App;
|
||||
use think\Loader;
|
||||
/**
|
||||
* ThinkPHP RPC控制器类
|
||||
*/
|
||||
@@ -33,14 +34,14 @@ abstract class Rpc
|
||||
}
|
||||
|
||||
//导入类库
|
||||
\think\Loader::import('vendor.phprpc.phprpc_server');
|
||||
Loader::import('vendor.phprpc.phprpc_server');
|
||||
//实例化phprpc
|
||||
$server = new \PHPRPC_Server();
|
||||
if ($this->allowMethodList) {
|
||||
$methods = $this->allowMethodList;
|
||||
} else {
|
||||
$methods = get_class_methods($this);
|
||||
$methods = array_diff($methods, array('__construct', '__call', '_initialize'));
|
||||
$methods = array_diff($methods, ['__construct', '__call', '_initialize']);
|
||||
}
|
||||
$server->add($methods, $this);
|
||||
|
||||
|
||||
@@ -72,8 +72,8 @@ abstract class Builder
|
||||
/**
|
||||
* 数据分析
|
||||
* @access protected
|
||||
* @param array $data 数据
|
||||
* @param array $options 查询参数
|
||||
* @param array $data 数据
|
||||
* @param array $options 查询参数
|
||||
* @return array
|
||||
*/
|
||||
protected function parseData($data, $options)
|
||||
@@ -213,7 +213,8 @@ abstract class Builder
|
||||
/**
|
||||
* 生成查询条件SQL
|
||||
* @access public
|
||||
* @param mixed $where
|
||||
* @param mixed $where
|
||||
* @param string $table
|
||||
* @return string
|
||||
*/
|
||||
public function buildWhere($where, $table)
|
||||
@@ -361,8 +362,8 @@ abstract class Builder
|
||||
/**
|
||||
* 日期时间条件解析
|
||||
* @access protected
|
||||
* @param string $value
|
||||
* @param string $key
|
||||
* @param string $value
|
||||
* @param string $key
|
||||
* @return string
|
||||
*/
|
||||
protected function parseDateTime($value, $key)
|
||||
@@ -563,9 +564,9 @@ abstract class Builder
|
||||
/**
|
||||
* 生成insert SQL
|
||||
* @access public
|
||||
* @param array $data 数据
|
||||
* @param array $options 表达式
|
||||
* @param bool $replace 是否replace
|
||||
* @param array $data 数据
|
||||
* @param array $options 表达式
|
||||
* @param bool $replace 是否replace
|
||||
* @return string
|
||||
*/
|
||||
public function insert(array $data, $options = [], $replace = false)
|
||||
@@ -594,8 +595,8 @@ abstract class Builder
|
||||
/**
|
||||
* 生成insertall SQL
|
||||
* @access public
|
||||
* @param array $dataSet 数据集
|
||||
* @param array $options 表达式
|
||||
* @param array $dataSet 数据集
|
||||
* @param array $options 表达式
|
||||
* @return string
|
||||
*/
|
||||
public function insertAll($dataSet, $options)
|
||||
@@ -640,9 +641,9 @@ abstract class Builder
|
||||
/**
|
||||
* 生成slectinsert SQL
|
||||
* @access public
|
||||
* @param array $fields 数据
|
||||
* @param string $table 数据表
|
||||
* @param array $options 表达式
|
||||
* @param array $fields 数据
|
||||
* @param string $table 数据表
|
||||
* @param array $options 表达式
|
||||
* @return string
|
||||
*/
|
||||
public function selectInsert($fields, $table, $options)
|
||||
@@ -659,8 +660,8 @@ abstract class Builder
|
||||
/**
|
||||
* 生成update SQL
|
||||
* @access public
|
||||
* @param array $fields 数据
|
||||
* @param array $options 表达式
|
||||
* @param array $fields 数据
|
||||
* @param array $options 表达式
|
||||
* @return string
|
||||
*/
|
||||
public function update($data, $options)
|
||||
|
||||
@@ -138,8 +138,8 @@ abstract class Connection
|
||||
/**
|
||||
* 调用Query类的查询方法
|
||||
* @access public
|
||||
* @param string $method 方法名称
|
||||
* @param array $args 调用参数
|
||||
* @param string $method 方法名称
|
||||
* @param array $args 调用参数
|
||||
* @return mixed
|
||||
*/
|
||||
public function __call($method, $args)
|
||||
@@ -219,8 +219,8 @@ abstract class Connection
|
||||
/**
|
||||
* 设置数据库的配置参数
|
||||
* @access public
|
||||
* @param string $config 配置名称
|
||||
* @param mixed $value 配置值
|
||||
* @param string $config 配置名称
|
||||
* @param mixed $value 配置值
|
||||
* @return void
|
||||
*/
|
||||
public function setConfig($config, $value)
|
||||
@@ -231,9 +231,9 @@ abstract class Connection
|
||||
/**
|
||||
* 连接数据库方法
|
||||
* @access public
|
||||
* @param array $config 连接参数
|
||||
* @param integer $linkNum 连接序号
|
||||
* @param array|bool $autoConnection 是否自动连接主数据库(用于分布式)
|
||||
* @param array $config 连接参数
|
||||
* @param integer $linkNum 连接序号
|
||||
* @param array|bool $autoConnection 是否自动连接主数据库(用于分布式)
|
||||
* @return PDO
|
||||
* @throws Exception
|
||||
*/
|
||||
@@ -314,10 +314,10 @@ abstract class Connection
|
||||
/**
|
||||
* 执行查询 返回数据集
|
||||
* @access public
|
||||
* @param string $sql sql指令
|
||||
* @param array $bind 参数绑定
|
||||
* @param boolean $master 是否在主服务器读操作
|
||||
* @param bool|string $class 指定返回的数据集对象
|
||||
* @param string $sql sql指令
|
||||
* @param array $bind 参数绑定
|
||||
* @param boolean $master 是否在主服务器读操作
|
||||
* @param bool|string $class 指定返回的数据集对象
|
||||
* @return mixed
|
||||
* @throws BindParamException
|
||||
* @throws PDOException
|
||||
@@ -358,10 +358,10 @@ abstract class Connection
|
||||
/**
|
||||
* 执行语句
|
||||
* @access public
|
||||
* @param string $sql sql指令
|
||||
* @param array $bind 参数绑定
|
||||
* @param boolean $getLastInsID 是否获取自增ID
|
||||
* @param string $sequence 自增序列名
|
||||
* @param string $sql sql指令
|
||||
* @param array $bind 参数绑定
|
||||
* @param boolean $getLastInsID 是否获取自增ID
|
||||
* @param string $sequence 自增序列名
|
||||
* @return int
|
||||
* @throws BindParamException
|
||||
* @throws PDOException
|
||||
@@ -409,8 +409,8 @@ abstract class Connection
|
||||
/**
|
||||
* 根据参数绑定组装最终的SQL语句 便于调试
|
||||
* @access public
|
||||
* @param string $sql 带参数绑定的sql语句
|
||||
* @param array $bind 参数绑定列表
|
||||
* @param string $sql 带参数绑定的sql语句
|
||||
* @param array $bind 参数绑定列表
|
||||
* @return string
|
||||
*/
|
||||
public function getRealSql($sql, array $bind = [])
|
||||
@@ -463,8 +463,8 @@ abstract class Connection
|
||||
/**
|
||||
* 获得数据集
|
||||
* @access protected
|
||||
* @param bool|string $class true 返回PDOStatement 字符串用于指定返回的类名
|
||||
* @param bool $procedure 是否存储过程
|
||||
* @param bool|string $class true 返回PDOStatement 字符串用于指定返回的类名
|
||||
* @param bool $procedure 是否存储过程
|
||||
* @return mixed
|
||||
*/
|
||||
protected function getResult($class = '', $procedure = false)
|
||||
@@ -777,9 +777,9 @@ abstract class Connection
|
||||
/**
|
||||
* 触发SQL事件
|
||||
* @access protected
|
||||
* @param string $sql SQL语句
|
||||
* @param float $runtime SQL运行时间
|
||||
* @param mixed $explain SQL分析
|
||||
* @param string $sql SQL语句
|
||||
* @param float $runtime SQL运行时间
|
||||
* @param mixed $explain SQL分析
|
||||
* @return bool
|
||||
*/
|
||||
protected function trigger($sql, $runtime, $explain = [])
|
||||
|
||||
@@ -67,8 +67,8 @@ class Query
|
||||
/**
|
||||
* 利用__call方法实现一些特殊的Model方法
|
||||
* @access public
|
||||
* @param string $method 方法名称
|
||||
* @param array $args 调用参数
|
||||
* @param string $method 方法名称
|
||||
* @param array $args 调用参数
|
||||
* @return mixed
|
||||
* @throws DbException
|
||||
* @throws Exception
|
||||
@@ -176,11 +176,11 @@ class Query
|
||||
/**
|
||||
* 执行查询 返回数据集
|
||||
* @access public
|
||||
* @param string $sql sql指令
|
||||
* @param array $bind 参数绑定
|
||||
* @param boolean $fetch 不执行只是获取SQL
|
||||
* @param boolean $master 是否在主服务器读操作
|
||||
* @param bool|string $class 指定返回的数据集对象
|
||||
* @param string $sql sql指令
|
||||
* @param array $bind 参数绑定
|
||||
* @param boolean $fetch 不执行只是获取SQL
|
||||
* @param boolean $master 是否在主服务器读操作
|
||||
* @param bool|string $class 指定返回的数据集对象
|
||||
* @return mixed
|
||||
* @throws BindParamException
|
||||
* @throws PDOException
|
||||
@@ -193,11 +193,11 @@ class Query
|
||||
/**
|
||||
* 执行语句
|
||||
* @access public
|
||||
* @param string $sql sql指令
|
||||
* @param array $bind 参数绑定
|
||||
* @param boolean $fetch 不执行只是获取SQL
|
||||
* @param boolean $getLastInsID 是否获取自增ID
|
||||
* @param boolean $sequence 自增序列名
|
||||
* @param string $sql sql指令
|
||||
* @param array $bind 参数绑定
|
||||
* @param boolean $fetch 不执行只是获取SQL
|
||||
* @param boolean $getLastInsID 是否获取自增ID
|
||||
* @param boolean $sequence 自增序列名
|
||||
* @return int
|
||||
* @throws BindParamException
|
||||
* @throws PDOException
|
||||
@@ -296,9 +296,9 @@ class Query
|
||||
/**
|
||||
* 得到分表的的数据表名
|
||||
* @access public
|
||||
* @param array $data 操作的数据
|
||||
* @param string $field 分表依据的字段
|
||||
* @param array $rule 分表规则
|
||||
* @param array $data 操作的数据
|
||||
* @param string $field 分表依据的字段
|
||||
* @param array $rule 分表规则
|
||||
* @return string
|
||||
*/
|
||||
public function getPartitionTableName($data, $field, $rule = [])
|
||||
@@ -372,8 +372,8 @@ class Query
|
||||
/**
|
||||
* 得到某个字段的值
|
||||
* @access public
|
||||
* @param string $field 字段名
|
||||
* @param mixed $default 默认值
|
||||
* @param string $field 字段名
|
||||
* @param mixed $default 默认值
|
||||
* @return mixed
|
||||
*/
|
||||
public function value($field, $default = null)
|
||||
@@ -408,8 +408,8 @@ class Query
|
||||
/**
|
||||
* 得到某个列的数组
|
||||
* @access public
|
||||
* @param string $field 字段名 多个字段用逗号分隔
|
||||
* @param string $key 索引
|
||||
* @param string $field 字段名 多个字段用逗号分隔
|
||||
* @param string $key 索引
|
||||
* @return array
|
||||
*/
|
||||
public function column($field, $key = '')
|
||||
@@ -525,8 +525,8 @@ class Query
|
||||
* 设置记录的某个字段值
|
||||
* 支持使用数据库字段和方法
|
||||
* @access public
|
||||
* @param string|array $field 字段名
|
||||
* @param mixed $value 字段值
|
||||
* @param string|array $field 字段名
|
||||
* @param mixed $value 字段值
|
||||
* @return integer
|
||||
*/
|
||||
public function setField($field, $value = '')
|
||||
@@ -542,9 +542,9 @@ class Query
|
||||
/**
|
||||
* 字段值(延迟)增长
|
||||
* @access public
|
||||
* @param string $field 字段名
|
||||
* @param integer $step 增长值
|
||||
* @param integer $lazyTime 延时时间(s)
|
||||
* @param string $field 字段名
|
||||
* @param integer $step 增长值
|
||||
* @param integer $lazyTime 延时时间(s)
|
||||
* @return integer|true
|
||||
* @throws Exception
|
||||
*/
|
||||
@@ -569,9 +569,9 @@ class Query
|
||||
/**
|
||||
* 字段值(延迟)减少
|
||||
* @access public
|
||||
* @param string $field 字段名
|
||||
* @param integer $step 减少值
|
||||
* @param integer $lazyTime 延时时间(s)
|
||||
* @param string $field 字段名
|
||||
* @param integer $step 减少值
|
||||
* @param integer $lazyTime 延时时间(s)
|
||||
* @return integer|true
|
||||
* @throws Exception
|
||||
*/
|
||||
@@ -597,9 +597,9 @@ class Query
|
||||
* 延时更新检查 返回false表示需要延时
|
||||
* 否则返回实际写入的数值
|
||||
* @access public
|
||||
* @param string $guid 写入标识
|
||||
* @param integer $step 写入步进值
|
||||
* @param integer $lazyTime 延时时间(s)
|
||||
* @param string $guid 写入标识
|
||||
* @param integer $step 写入步进值
|
||||
* @param integer $lazyTime 延时时间(s)
|
||||
* @return false|integer
|
||||
*/
|
||||
protected function lazyWrite($guid, $step, $lazyTime)
|
||||
@@ -628,9 +628,9 @@ class Query
|
||||
/**
|
||||
* 查询SQL组装 join
|
||||
* @access public
|
||||
* @param mixed $join 关联的表名
|
||||
* @param mixed $condition 条件
|
||||
* @param string $type JOIN类型
|
||||
* @param mixed $join 关联的表名
|
||||
* @param mixed $condition 条件
|
||||
* @param string $type JOIN类型
|
||||
* @return $this
|
||||
*/
|
||||
public function join($join, $condition = null, $type = 'INNER')
|
||||
@@ -681,8 +681,8 @@ class Query
|
||||
/**
|
||||
* 查询SQL组装 union
|
||||
* @access public
|
||||
* @param mixed $union
|
||||
* @param boolean $all
|
||||
* @param mixed $union
|
||||
* @param boolean $all
|
||||
* @return $this
|
||||
*/
|
||||
public function union($union, $all = false)
|
||||
@@ -700,11 +700,11 @@ class Query
|
||||
/**
|
||||
* 指定查询字段 支持字段排除和指定数据表
|
||||
* @access public
|
||||
* @param mixed $field
|
||||
* @param boolean $except 是否排除
|
||||
* @param string $tableName 数据表名
|
||||
* @param string $prefix 字段前缀
|
||||
* @param string $alias 别名前缀
|
||||
* @param mixed $field
|
||||
* @param boolean $except 是否排除
|
||||
* @param string $tableName 数据表名
|
||||
* @param string $prefix 字段前缀
|
||||
* @param string $alias 别名前缀
|
||||
* @return $this
|
||||
*/
|
||||
public function field($field, $except = false, $tableName = '', $prefix = '', $alias = '')
|
||||
@@ -745,10 +745,10 @@ class Query
|
||||
/**
|
||||
* 指定JOIN查询字段
|
||||
* @access public
|
||||
* @param string|array $table 数据表
|
||||
* @param string|array $field 查询字段
|
||||
* @param string|array $on JOIN条件
|
||||
* @param string $type JOIN类型
|
||||
* @param string|array $table 数据表
|
||||
* @param string|array $field 查询字段
|
||||
* @param string|array $on JOIN条件
|
||||
* @param string $type JOIN类型
|
||||
* @return $this
|
||||
*/
|
||||
public function view($join, $field = null, $on = null, $type = 'INNER')
|
||||
@@ -796,9 +796,9 @@ class Query
|
||||
/**
|
||||
* 设置分表规则
|
||||
* @access public
|
||||
* @param array $data 操作的数据
|
||||
* @param string $field 分表依据的字段
|
||||
* @param array $rule 分表规则
|
||||
* @param array $data 操作的数据
|
||||
* @param string $field 分表依据的字段
|
||||
* @param array $rule 分表规则
|
||||
* @return $this
|
||||
*/
|
||||
public function partition($data, $field, $rule = [])
|
||||
@@ -810,9 +810,9 @@ class Query
|
||||
/**
|
||||
* 指定AND查询条件
|
||||
* @access public
|
||||
* @param mixed $field 查询字段
|
||||
* @param mixed $op 查询表达式
|
||||
* @param mixed $condition 查询条件
|
||||
* @param mixed $field 查询字段
|
||||
* @param mixed $op 查询表达式
|
||||
* @param mixed $condition 查询条件
|
||||
* @return $this
|
||||
*/
|
||||
public function where($field, $op = null, $condition = null)
|
||||
@@ -826,9 +826,9 @@ class Query
|
||||
/**
|
||||
* 指定OR查询条件
|
||||
* @access public
|
||||
* @param mixed $field 查询字段
|
||||
* @param mixed $op 查询表达式
|
||||
* @param mixed $condition 查询条件
|
||||
* @param mixed $field 查询字段
|
||||
* @param mixed $op 查询表达式
|
||||
* @param mixed $condition 查询条件
|
||||
* @return $this
|
||||
*/
|
||||
public function whereOr($field, $op = null, $condition = null)
|
||||
@@ -842,9 +842,9 @@ class Query
|
||||
/**
|
||||
* 指定XOR查询条件
|
||||
* @access public
|
||||
* @param mixed $field 查询字段
|
||||
* @param mixed $op 查询表达式
|
||||
* @param mixed $condition 查询条件
|
||||
* @param mixed $field 查询字段
|
||||
* @param mixed $op 查询表达式
|
||||
* @param mixed $condition 查询条件
|
||||
* @return $this
|
||||
*/
|
||||
public function whereXor($field, $op = null, $condition = null)
|
||||
@@ -858,11 +858,11 @@ class Query
|
||||
/**
|
||||
* 分析查询表达式
|
||||
* @access public
|
||||
* @param string $logic 查询逻辑 and or xor
|
||||
* @param string $logic 查询逻辑 and or xor
|
||||
* @param string|array|\Closure $field 查询字段
|
||||
* @param mixed $op 查询表达式
|
||||
* @param mixed $condition 查询条件
|
||||
* @param array $param 查询参数
|
||||
* @param mixed $op 查询表达式
|
||||
* @param mixed $condition 查询条件
|
||||
* @param array $param 查询参数
|
||||
* @return void
|
||||
*/
|
||||
protected function parseWhereExp($logic, $field, $op, $condition, $param = [])
|
||||
@@ -944,9 +944,9 @@ class Query
|
||||
|
||||
/**
|
||||
* 分页查询
|
||||
* @param int|null $listRows 每页数量
|
||||
* @param bool $simple 简洁模式
|
||||
* @param array $config 配置参数
|
||||
* @param int|null $listRows 每页数量
|
||||
* @param bool $simple 简洁模式
|
||||
* @param array $config 配置参数
|
||||
* page:当前页,
|
||||
* path:url路径,
|
||||
* query:url额外参数,
|
||||
@@ -1013,8 +1013,8 @@ class Query
|
||||
/**
|
||||
* 指定排序 order('id','desc') 或者 order(['id'=>'desc','create_time'=>'desc'])
|
||||
* @access public
|
||||
* @param string|array $field 排序字段
|
||||
* @param string $order 排序
|
||||
* @param string|array $field 排序字段
|
||||
* @param string $order 排序
|
||||
* @return $this
|
||||
*/
|
||||
public function order($field, $order = null)
|
||||
@@ -1043,8 +1043,8 @@ class Query
|
||||
/**
|
||||
* 查询缓存
|
||||
* @access public
|
||||
* @param mixed $key
|
||||
* @param integer $expire
|
||||
* @param mixed $key 缓存key
|
||||
* @param integer $expire 缓存有效期
|
||||
* @return $this
|
||||
*/
|
||||
public function cache($key = true, $expire = null)
|
||||
@@ -1344,9 +1344,9 @@ class Query
|
||||
/**
|
||||
* 参数绑定
|
||||
* @access public
|
||||
* @param mixed $key 参数名
|
||||
* @param mixed $value 绑定变量值
|
||||
* @param integer $type 绑定类型
|
||||
* @param mixed $key 参数名
|
||||
* @param mixed $value 绑定变量值
|
||||
* @param integer $type 绑定类型
|
||||
* @return $this
|
||||
*/
|
||||
public function bind($key, $value = false, $type = PDO::PARAM_STR)
|
||||
@@ -1520,8 +1520,8 @@ class Query
|
||||
/**
|
||||
* 把主键值转换为查询条件 支持复合主键
|
||||
* @access public
|
||||
* @param array|string $data 主键数据
|
||||
* @param mixed $options 表达式参数
|
||||
* @param array|string $data 主键数据
|
||||
* @param mixed $options 表达式参数
|
||||
* @return void
|
||||
* @throws Exception
|
||||
*/
|
||||
@@ -1565,10 +1565,10 @@ class Query
|
||||
/**
|
||||
* 插入记录
|
||||
* @access public
|
||||
* @param mixed $data 数据
|
||||
* @param boolean $replace 是否replace
|
||||
* @param boolean $getLastInsID 是否获取自增ID
|
||||
* @param string $sequence 自增序列名
|
||||
* @param mixed $data 数据
|
||||
* @param boolean $replace 是否replace
|
||||
* @param boolean $getLastInsID 是否获取自增ID
|
||||
* @param string $sequence 自增序列名
|
||||
* @return integer|string
|
||||
*/
|
||||
public function insert(array $data, $replace = false, $getLastInsID = false, $sequence = null)
|
||||
@@ -1589,9 +1589,9 @@ class Query
|
||||
/**
|
||||
* 插入记录并获取自增ID
|
||||
* @access public
|
||||
* @param mixed $data 数据
|
||||
* @param boolean $replace 是否replace
|
||||
* @param string $sequence 自增序列名
|
||||
* @param mixed $data 数据
|
||||
* @param boolean $replace 是否replace
|
||||
* @param string $sequence 自增序列名
|
||||
* @return integer|string
|
||||
*/
|
||||
public function insertGetId(array $data, $replace = false, $sequence = null)
|
||||
@@ -1626,8 +1626,8 @@ class Query
|
||||
/**
|
||||
* 通过Select方式插入记录
|
||||
* @access public
|
||||
* @param string $fields 要插入的数据表字段名
|
||||
* @param string $table 要插入的数据表名
|
||||
* @param string $fields 要插入的数据表字段名
|
||||
* @param string $table 要插入的数据表名
|
||||
* @return integer|string
|
||||
* @throws PDOException
|
||||
*/
|
||||
@@ -1895,9 +1895,9 @@ class Query
|
||||
/**
|
||||
* 分批数据返回处理
|
||||
* @access public
|
||||
* @param integer $count 每次处理的数据数量
|
||||
* @param callable $callback 处理回调方法
|
||||
* @param string $column 分批处理的字段名
|
||||
* @param integer $count 每次处理的数据数量
|
||||
* @param callable $callback 处理回调方法
|
||||
* @param string $column 分批处理的字段名
|
||||
* @return boolean
|
||||
*/
|
||||
public function chunk($count, $callback, $column = null)
|
||||
|
||||
@@ -39,9 +39,9 @@ class Merge extends Model
|
||||
/**
|
||||
* 查找单条记录
|
||||
* @access public
|
||||
* @param mixed $data 主键值或者查询条件(闭包)
|
||||
* @param string $with 关联预查询
|
||||
* @param bool $cache 是否缓存
|
||||
* @param mixed $data 主键值或者查询条件(闭包)
|
||||
* @param string $with 关联预查询
|
||||
* @param bool $cache 是否缓存
|
||||
* @return \think\Model
|
||||
*/
|
||||
public static function get($data = '', $with = [], $cache = false)
|
||||
@@ -77,10 +77,10 @@ class Merge extends Model
|
||||
/**
|
||||
* 获取关联模型的字段 并解决混淆
|
||||
* @access protected
|
||||
* @param \think\db\Query $query 查询对象
|
||||
* @param string $name 模型名称
|
||||
* @param string $table 关联表名称
|
||||
* @param array $map 字段映射
|
||||
* @param \think\db\Query $query 查询对象
|
||||
* @param string $name 模型名称
|
||||
* @param string $table 关联表名称
|
||||
* @param array $map 字段映射
|
||||
* @return array
|
||||
*/
|
||||
protected static function getModelField($query, $name, $table = '', $map = [])
|
||||
@@ -102,8 +102,8 @@ class Merge extends Model
|
||||
/**
|
||||
* 查找所有记录
|
||||
* @access public
|
||||
* @param mixed $data 主键列表或者查询条件(闭包)
|
||||
* @param string $with 关联预查询
|
||||
* @param mixed $data 主键列表或者查询条件(闭包)
|
||||
* @param string $with 关联预查询
|
||||
* @return array|false|string
|
||||
*/
|
||||
public static function all($data = [], $with = [], $cache = false)
|
||||
@@ -116,9 +116,9 @@ class Merge extends Model
|
||||
/**
|
||||
* 处理写入的模型数据
|
||||
* @access public
|
||||
* @param string $model 模型名称
|
||||
* @param array $data 数据
|
||||
* @param bool $insert 是否新增
|
||||
* @param string $model 模型名称
|
||||
* @param array $data 数据
|
||||
* @param bool $insert 是否新增
|
||||
* @return void
|
||||
*/
|
||||
protected function parseData($model, $data, $insert = false)
|
||||
@@ -142,10 +142,10 @@ class Merge extends Model
|
||||
/**
|
||||
* 保存模型数据 以及关联数据
|
||||
* @access public
|
||||
* @param mixed $data 数据
|
||||
* @param array $where 更新条件
|
||||
* @param bool $getId 新增的时候是否获取id
|
||||
* @param bool $replace 是否replace
|
||||
* @param mixed $data 数据
|
||||
* @param array $where 更新条件
|
||||
* @param bool $getId 新增的时候是否获取id
|
||||
* @param bool $replace 是否replace
|
||||
* @return mixed
|
||||
*/
|
||||
public function save($data = [], $where = [], $getId = true, $replace = false)
|
||||
|
||||
@@ -125,9 +125,9 @@ class Relation
|
||||
/**
|
||||
* 预载入关联查询 返回数据集
|
||||
* @access public
|
||||
* @param array $resultSet 数据集
|
||||
* @param string $relation 关联名
|
||||
* @param string $class 数据集对象名 为空表示数组
|
||||
* @param array $resultSet 数据集
|
||||
* @param string $relation 关联名
|
||||
* @param string $class 数据集对象名 为空表示数组
|
||||
* @return array
|
||||
*/
|
||||
public function eagerlyResultSet($resultSet, $relation, $class = '')
|
||||
@@ -221,8 +221,8 @@ class Relation
|
||||
/**
|
||||
* 封装关联数据集
|
||||
* @access public
|
||||
* @param array $resultSet 数据集
|
||||
* @param string $class 数据集类名
|
||||
* @param array $resultSet 数据集
|
||||
* @param string $class 数据集类名
|
||||
* @return mixed
|
||||
*/
|
||||
protected function resultSetBuild($resultSet, $class = '')
|
||||
@@ -233,10 +233,10 @@ class Relation
|
||||
/**
|
||||
* 预载入关联查询 返回模型对象
|
||||
* @access public
|
||||
* @param Model $result 数据对象
|
||||
* @param string $relation 关联名
|
||||
* @param string $class 数据集对象名 为空表示数组
|
||||
* @return \think\Model
|
||||
* @param Model $result 数据对象
|
||||
* @param string $relation 关联名
|
||||
* @param string $class 数据集对象名 为空表示数组
|
||||
* @return Model
|
||||
*/
|
||||
public function eagerlyResult($result, $relation, $class = '')
|
||||
{
|
||||
@@ -295,9 +295,9 @@ class Relation
|
||||
/**
|
||||
* 一对一 关联模型预查询拼装
|
||||
* @access public
|
||||
* @param string $model 模型名称
|
||||
* @param string $relation 关联名
|
||||
* @param Model $result 模型对象实例
|
||||
* @param string $model 模型名称
|
||||
* @param string $relation 关联名
|
||||
* @param Model $result 模型对象实例
|
||||
* @return void
|
||||
*/
|
||||
protected function match($model, $relation, &$result)
|
||||
@@ -324,11 +324,11 @@ class Relation
|
||||
/**
|
||||
* 一对多 关联模型预查询
|
||||
* @access public
|
||||
* @param object $model 关联模型对象
|
||||
* @param array $where 关联预查询条件
|
||||
* @param string $relation 关联名
|
||||
* @param string $subRelation 子关联
|
||||
* @param bool $closure
|
||||
* @param object $model 关联模型对象
|
||||
* @param array $where 关联预查询条件
|
||||
* @param string $relation 关联名
|
||||
* @param string $subRelation 子关联
|
||||
* @param bool $closure
|
||||
* @return array
|
||||
*/
|
||||
protected function eagerlyOneToMany($model, $where, $relation, $subRelation = '', $closure = false)
|
||||
@@ -348,10 +348,10 @@ class Relation
|
||||
/**
|
||||
* 多对多 关联模型预查询
|
||||
* @access public
|
||||
* @param object $model 关联模型对象
|
||||
* @param array $where 关联预查询条件
|
||||
* @param string $relation 关联名
|
||||
* @param string $subRelation 子关联
|
||||
* @param object $model 关联模型对象
|
||||
* @param array $where 关联预查询条件
|
||||
* @param string $relation 关联名
|
||||
* @param string $subRelation 子关联
|
||||
* @return array
|
||||
*/
|
||||
protected function eagerlyManyToMany($model, $where, $relation, $subRelation = '')
|
||||
@@ -514,11 +514,11 @@ class Relation
|
||||
/**
|
||||
* BELONGS TO MANY 关联查询
|
||||
* @access public
|
||||
* @param object $model 关联模型对象
|
||||
* @param string $table 中间表名
|
||||
* @param string $foreignKey 关联模型关联键
|
||||
* @param string $localKey 当前模型关联键
|
||||
* @param array $condition 关联查询条件
|
||||
* @param object $model 关联模型对象
|
||||
* @param string $table 中间表名
|
||||
* @param string $foreignKey 关联模型关联键
|
||||
* @param string $localKey 当前模型关联键
|
||||
* @param array $condition 关联查询条件
|
||||
* @return \think\db\Query|string
|
||||
*/
|
||||
protected function belongsToManyQuery($model, $table, $foreignKey, $localKey, $condition = [])
|
||||
@@ -535,8 +535,8 @@ class Relation
|
||||
/**
|
||||
* 保存(新增)当前关联数据对象
|
||||
* @access public
|
||||
* @param mixed $data 数据 可以使用数组 关联模型对象 和 关联对象的主键
|
||||
* @param array $pivot 中间表额外数据
|
||||
* @param mixed $data 数据 可以使用数组 关联模型对象 和 关联对象的主键
|
||||
* @param array $pivot 中间表额外数据
|
||||
* @return integer
|
||||
*/
|
||||
public function save($data, array $pivot = [])
|
||||
@@ -562,8 +562,8 @@ class Relation
|
||||
/**
|
||||
* 批量保存当前关联数据对象
|
||||
* @access public
|
||||
* @param array $dataSet 数据集
|
||||
* @param array $pivot 中间表额外数据
|
||||
* @param array $dataSet 数据集
|
||||
* @param array $pivot 中间表额外数据
|
||||
* @return integer
|
||||
*/
|
||||
public function saveAll(array $dataSet, array $pivot = [])
|
||||
@@ -588,8 +588,8 @@ class Relation
|
||||
/**
|
||||
* 附加关联的一个中间表数据
|
||||
* @access public
|
||||
* @param mixed $data 数据 可以使用数组、关联模型对象 或者 关联对象的主键
|
||||
* @param array $pivot 中间表额外数据
|
||||
* @param mixed $data 数据 可以使用数组、关联模型对象 或者 关联对象的主键
|
||||
* @param array $pivot 中间表额外数据
|
||||
* @return integer
|
||||
*/
|
||||
public function attach($data, $pivot = [])
|
||||
@@ -622,8 +622,8 @@ class Relation
|
||||
/**
|
||||
* 解除关联的一个中间表数据
|
||||
* @access public
|
||||
* @param integer|array $data 数据 可以使用关联对象的主键
|
||||
* @param bool $relationDel 是否同时删除关联表数据
|
||||
* @param integer|array $data 数据 可以使用关联对象的主键
|
||||
* @param bool $relationDel 是否同时删除关联表数据
|
||||
* @return integer
|
||||
*/
|
||||
public function detach($data, $relationDel = false)
|
||||
|
||||
@@ -34,8 +34,8 @@ class Memcache extends SessionHandler
|
||||
/**
|
||||
* 打开Session
|
||||
* @access public
|
||||
* @param string $savePath
|
||||
* @param mixed $sessName
|
||||
* @param string $savePath
|
||||
* @param mixed $sessName
|
||||
*/
|
||||
public function open($savePath, $sessName)
|
||||
{
|
||||
@@ -85,8 +85,8 @@ class Memcache extends SessionHandler
|
||||
/**
|
||||
* 写入Session
|
||||
* @access public
|
||||
* @param string $sessID
|
||||
* @param String $sessData
|
||||
* @param string $sessID
|
||||
* @param String $sessData
|
||||
*/
|
||||
public function write($sessID, $sessData)
|
||||
{
|
||||
|
||||
@@ -35,8 +35,8 @@ class Memcached extends SessionHandler
|
||||
/**
|
||||
* 打开Session
|
||||
* @access public
|
||||
* @param string $savePath
|
||||
* @param mixed $sessName
|
||||
* @param string $savePath
|
||||
* @param mixed $sessName
|
||||
*/
|
||||
public function open($savePath, $sessName)
|
||||
{
|
||||
|
||||
@@ -35,8 +35,8 @@ class Redis extends SessionHandler
|
||||
/**
|
||||
* 打开Session
|
||||
* @access public
|
||||
* @param string $savePath
|
||||
* @param mixed $sessName
|
||||
* @param string $savePath
|
||||
* @param mixed $sessName
|
||||
*/
|
||||
public function open($savePath, $sessName)
|
||||
{
|
||||
|
||||
@@ -186,8 +186,8 @@ class TagLib
|
||||
/**
|
||||
* 按标签生成正则
|
||||
* @access private
|
||||
* @param array|string $tags 标签名
|
||||
* @param boolean $close 是否为闭合标签
|
||||
* @param array|string $tags 标签名
|
||||
* @param boolean $close 是否为闭合标签
|
||||
* @return string
|
||||
*/
|
||||
private function getRegex($tags, $close)
|
||||
|
||||
@@ -17,8 +17,8 @@ class File
|
||||
{
|
||||
/**
|
||||
* 写入编译缓存
|
||||
* @string $cacheFile 缓存的文件名
|
||||
* @string $content 缓存的内容
|
||||
* @param string $cacheFile 缓存的文件名
|
||||
* @param string $content 缓存的内容
|
||||
* @return void|array
|
||||
*/
|
||||
public function write($cacheFile, $content)
|
||||
@@ -36,8 +36,8 @@ class File
|
||||
|
||||
/**
|
||||
* 读取编译编译
|
||||
* @string $cacheFile 缓存的文件名
|
||||
* @array $vars 变量数组
|
||||
* @param string $cacheFile 缓存的文件名
|
||||
* @param array $vars 变量数组
|
||||
* @return void
|
||||
*/
|
||||
public function read($cacheFile, $vars = [])
|
||||
@@ -52,8 +52,8 @@ class File
|
||||
|
||||
/**
|
||||
* 检查编译缓存是否有效
|
||||
* @string $cacheFile 缓存的文件名
|
||||
* @int $cacheTime 缓存时间
|
||||
* @param string $cacheFile 缓存的文件名
|
||||
* @param int $cacheTime 缓存时间
|
||||
* @return boolean
|
||||
*/
|
||||
public function check($cacheFile, $cacheTime)
|
||||
|
||||
@@ -37,8 +37,8 @@ class Sae
|
||||
|
||||
/**
|
||||
* 写入编译缓存
|
||||
* @string $cacheFile 缓存的文件名
|
||||
* @string $content 缓存的内容
|
||||
* @param string $cacheFile 缓存的文件名
|
||||
* @param string $content 缓存的内容
|
||||
* @return void|array
|
||||
*/
|
||||
public function write($cacheFile, $content)
|
||||
@@ -55,8 +55,8 @@ class Sae
|
||||
|
||||
/**
|
||||
* 读取编译编译
|
||||
* @string $cacheFile 缓存的文件名
|
||||
* @array $vars 变量数组
|
||||
* @param string $cacheFile 缓存的文件名
|
||||
* @param array $vars 变量数组
|
||||
* @return void
|
||||
*/
|
||||
public function read($cacheFile, $vars = [])
|
||||
@@ -69,8 +69,8 @@ class Sae
|
||||
|
||||
/**
|
||||
* 检查编译缓存是否有效
|
||||
* @string $cacheFile 缓存的文件名
|
||||
* @int $cacheTime 缓存时间
|
||||
* @param string $cacheFile 缓存的文件名
|
||||
* @param int $cacheTime 缓存时间
|
||||
* @return boolean
|
||||
*/
|
||||
public function check($cacheFile, $cacheTime)
|
||||
|
||||
@@ -51,8 +51,8 @@ class Php
|
||||
/**
|
||||
* 渲染模板文件
|
||||
* @access public
|
||||
* @param string $template 模板文件
|
||||
* @param array $data 模板变量
|
||||
* @param string $template 模板文件
|
||||
* @param array $data 模板变量
|
||||
* @return void
|
||||
*/
|
||||
public function fetch($template, $data = [])
|
||||
@@ -74,8 +74,8 @@ class Php
|
||||
/**
|
||||
* 渲染模板内容
|
||||
* @access public
|
||||
* @param string $content 模板内容
|
||||
* @param array $data 模板变量
|
||||
* @param string $content 模板内容
|
||||
* @param array $data 模板变量
|
||||
* @return void
|
||||
*/
|
||||
public function display($content, $data = [])
|
||||
@@ -117,7 +117,6 @@ class Php
|
||||
}
|
||||
}
|
||||
return $path . ltrim($template, '/') . '.' . ltrim($this->config['view_suffix'], '.');
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -60,9 +60,9 @@ class Think
|
||||
/**
|
||||
* 渲染模板文件
|
||||
* @access public
|
||||
* @param string $template 模板文件
|
||||
* @param array $data 模板变量
|
||||
* @param array $config 模板参数
|
||||
* @param string $template 模板文件
|
||||
* @param array $data 模板变量
|
||||
* @param array $config 模板参数
|
||||
* @return void
|
||||
*/
|
||||
public function fetch($template, $data = [], $config = [])
|
||||
@@ -83,9 +83,9 @@ class Think
|
||||
/**
|
||||
* 渲染模板内容
|
||||
* @access public
|
||||
* @param string $template 模板内容
|
||||
* @param array $data 模板变量
|
||||
* @param array $config 模板参数
|
||||
* @param string $template 模板内容
|
||||
* @param array $data 模板变量
|
||||
* @param array $config 模板参数
|
||||
* @return void
|
||||
*/
|
||||
public function display($template, $data = [], $config = [])
|
||||
|
||||
Reference in New Issue
Block a user