Fetch the repository succeeded.
This action will force synchronization from Anyon/ThinkLibrary, which will overwrite any changes that you have made since you forked the repository, and can not be recovered!!!
Synchronous operation will process in the background and will refresh the page when finishing processing. Please be patient.
ThinkLibrary 是针对 ThinkPHP5.1 版本封装的一套工具类库,方便快速构建 WEB 应用。
composer require zoujingli/think-library
library\Controller
,然后$this
就可能使用全部功能// 定义 MyController 控制器
class MyController extend \library\Controller{
// 指定当前数据表名
protected $dbQuery = '数据表名';
// 显示数据列表
public function index(){
return $this->_page($this->dbQuery);
}
// 当前列表数据处理
protected function _index_page_filter(&$data){
foreach($data as &$vo){
// @todo 修改原列表
}
}
}
CREATE TABLE `system_config` (
`id` int(11) unsigned NOT NULL AUTO_INCREMENT,
`name` varchar(100) DEFAULT NULL COMMENT '配置名',
`value` varchar(500) DEFAULT NULL COMMENT '配置值',
PRIMARY KEY (`id`) USING BTREE,
KEY `index_system_config_name` (`name`) USING BTREE
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COMMENT='系统配置';
// 列表展示
return $this->_page($dbQuery, $isPage, $isDisplay, $total);
// 列表展示搜索器(按 name、title 模糊搜索;按 status 精确搜索)
$query = $this->_query($dbQuery)->like('name,title')->equal('status');
return $this->_page($query->db(), $isPage, $isDisplay, $total);
// 表单显示及数据更新
return $this->_form($dbQuery, $tplFile, $pkField , $where, $data);
// 数据删除处理
return $this->_deleted($dbQuery);
// 数据禁用处理
return $this->_save($dbQuery,['status'=>'0']);
// 数据启用处理
return $this->_save($dbQuery,['status'=>'1']);
// 配置默认存储方式
sysconf('storage_type','文件存储类型');
// OSS存储配置
sysconf('storage_oss_domain', '文件访问域名');
sysconf('storage_oss_keyid', '接口授权AppId');
sysconf('storage_oss_secret', '接口授权AppSecret');
sysconf('storage_oss_bucket', '文件存储空间名称');
sysconf('storage_oss_is_https', '文件HTTP访问协议');
sysconf('storage_oss_endpoint', '文件存储节点域名');
// 七牛云存储配置
sysconf('storage_qiniu_region', '文件存储节点');
sysconf('storage_qiniu_domain', '文件访问域名');
sysconf('storage_qiniu_bucket', '文件存储空间名称');
sysconf('storage_qiniu_is_https', '文件HTTP访问协议');
sysconf('storage_qiniu_access_key', '接口授权AccessKey');
sysconf('storage_qiniu_secret_key', '接口授权SecretKey');
// 生成文件名称(链接url或文件md5)
$filename = \library\File::name($url,$ext,$prv,$fun);
// 获取文件内容(自动存储方式)
$result = \library\File::get($filename)
// 保存内容到文件(自动存储方式)
boolean \library\File::save($filename,$content);
// 判断文件是否存在
boolean \library\File::has($filename);
// 获取文件信息
$result = \library\File::info($filename);
//指定存储类型(调用方法)
boolean \library\File::instance('oss')->save($filename,$content);
boolean \library\File::instance('local')->save($filename,$content);
boolean \library\File::instance('qiniu')->save($filename,$content);
$result = \library\File::instance('oss')->get($filename);
$result = \library\File::instance('local')->get($filename);
$result = \library\File::instance('qiniu')->get($filename);
boolean \library\File::instance('oss')->has($filename);
boolean \library\File::instance('local')->has($filename);
boolean \library\File::instance('qiniu')->has($filename);
$resutl = \library\File::instance('oss')->info($filename);
$resutl = \library\File::instance('local')->info($filename);
$resutl = \library\File::instance('qiniu')->info($filename);
// 指定关键列更新($where 为扩展条件)
boolean data_save($dbQuery,$data,'pkname',$where);
// 发起get请求
$result = http_get($url,$query,$options);
\library\tools\Http::get($url,$query,$options);
// 发起post请求
$result = http_post($url,$data,$options);
\library\tools\Http::post($url,$data,$options);
// 输入数据库前转义
$content = emoji_encode($content);
// 输出数据库后转义
$content = emoji_decode($content);
// 设置参数
sysconf($keyname,$keyvalue);
// 获取参数
$keyvalue = sysconf($kename);
// 字符串加密操作
$string = encode($content);
// 加密字符串解密
$content = decode($string);
此处可能存在不合适展示的内容,页面不予展示。您可通过相关编辑功能自查并修改。
如您确认内容无涉及 不当用语 / 纯广告导流 / 暴力 / 低俗色情 / 侵权 / 盗版 / 虚假 / 无价值内容或违法国家有关法律法规的内容,可点击提交进行申诉,我们将尽快为您处理。