首页
留言
Search
1
在Centos7下搭建Socks5代理服务器
1,279 阅读
2
在windows11通过Zip安装Mysql5.7
872 阅读
3
Mysql5.7开放远程登录
782 阅读
4
数据库
737 阅读
5
mysql5.7基本命令
645 阅读
综合
正则表达式
git
系统
centos7
ubuntu
kali
Debian
网络
socks5
wireguard
运维
docker
hadoop
kubernetes
hive
openstack
ElasticSearch
ansible
前端
三剑客
Python
Python3
selenium
Flask
PHP
PHP基础
ThinkPHP
游戏
我的世界
算法
递归
排序
查找
软件
ide
Xshell
vim
PicGo
Typora
云盘
安全
靶场
reverse
Java
JavaSE
Spring
MyBatis
C++
QT
数据库
mysql
登录
Search
标签搜索
java
centos7
linux
centos
html5
JavaScript
php
css3
mysql
spring
mysql5.7
linux全栈
ubuntu
BeanFactory
SpringBean
python
python3
ApplicationContext
kali
mysql8.0
我亏一点
累计撰写
140
篇文章
累计收到
59
条评论
首页
栏目
综合
正则表达式
git
系统
centos7
ubuntu
kali
Debian
网络
socks5
wireguard
运维
docker
hadoop
kubernetes
hive
openstack
ElasticSearch
ansible
前端
三剑客
Python
Python3
selenium
Flask
PHP
PHP基础
ThinkPHP
游戏
我的世界
算法
递归
排序
查找
软件
ide
Xshell
vim
PicGo
Typora
云盘
安全
靶场
reverse
Java
JavaSE
Spring
MyBatis
C++
QT
数据库
mysql
页面
留言
搜索到
4
篇与
thinkphp
的结果
2026-03-13
苹果cms10 列表和搜索过滤会员组没有权限的数据
苹果cms10 列表和搜索过滤会员组没有权限的数据苹果cms10的列表中,会出现会员组没有权限的数据,只有点进去才会提示登录。1.新版本后台-》网站基础参数-》性能优化-》数据权限过滤开启即可2.老版本编辑文件application/common/model/Vod.php找到listData方法,增加过滤方法public function listData($where,$order,$page=1,$limit=20,$start=0,$field='*',$addition=1,$totalshow=1) { $page = $page > 0 ? (int)$page : 1; $limit = $limit ? (int)$limit : 20; $start = $start ? (int)$start : 0; if(!is_array($where)){ $where = json_decode($where,true); } $where2=''; if(!empty($where['_string'])){ $where2 = $where['_string']; unset($where['_string']); } // =====修改开始===== // 增加会员组过滤方法 $where3 = []; // 如果是用户请求 if(isset($GLOBALS['user'])){ $category_ids = array_filter(explode(',',$GLOBALS['user']['group']['group_type'])); $where3['type_id'] = ['in',$category_ids]; } $limit_str = ($limit * ($page-1) + $start) .",".$limit; if($totalshow==1) { // 增加where3查询 $total = $this->where($where)->where($where2)->where($where3)->count(); } // 增加where3查询 $list = Db::name('Vod')->field($field)->where($where)->where($where2)->where($where3)->order($order)->limit($limit_str)->select(); // =====修改结束===== //分类 $type_list = model('Type')->getCache('type_list'); //用户组 $group_list = model('Group')->getCache('group_list'); foreach($list as $k=>$v){ if($addition==1){ if(!empty($v['type_id'])) { $list[$k]['type'] = $type_list[$v['type_id']]; $list[$k]['type_1'] = $type_list[$list[$k]['type']['type_pid']]; } if(!empty($v['group_id'])) { $list[$k]['group'] = $group_list[$v['group_id']]; } } } return ['code'=>1,'msg'=>lang('data_list'),'page'=>$page,'pagecount'=>ceil($total/$limit),'limit'=>$limit,'total'=>$total,'list'=>$list]; }
2026年03月13日
3 阅读
0 评论
0 点赞
2023-02-15
ThinkPHP6 跨域开起后某些接口请求报错跨域
ThinkPHP6 跨域开起后某些接口请求报错跨域所有接口在本地调试正常,但是部署在服务器之后有的接口出现跨域报错。解决办法路由文件和控制器命名要规范,最好使用单个单词 原# 控制器名 PhotoAlbums.pnp # 控制器类名 PhotoAlbums # 路由名 Route::any('photoAlbums', 'home/photoAlbums/index')->name('photoAlbumsHome');现# 控制器名 Photo.pnp # 控制器类名 Photo # 路由名 Route::any('photo', 'home/photo/index')->name('photoHome');成功解决问题
2023年02月15日
416 阅读
0 评论
0 点赞
2023-02-15
ThinkPHP6 开起跨域
ThinkPHP6 开启接口跨域1.新建中间件<?php namespace app\home\middleware; use Closure; use think\middleware\AllowCrossDomain; use think\Request; use think\Response; use think\response\Redirect; class Allow extends AllowCrossDomain { protected $header = [ 'Access-Control-Allow-Credentials' => 'true', 'Access-Control-Max-Age' => 1800, 'Access-Control-Allow-Methods' => 'GET, POST, PATCH, PUT, DELETE, OPTIONS', 'Access-Control-Allow-Headers' => 'Authorization, Content-Type, If-Match, If-Modified-Since, If-None-Match, If-Unmodified-Since, X-CSRF-TOKEN, X-Requested-With, jwtToken', ]; }2.全局使用中间件或者路由使用中间件app/middleware.php<?php // 全局中间件定义文件 return [ // 加上这句 \app\home\middleware\Allow::class, ];
2023年02月15日
543 阅读
0 评论
0 点赞
2023-02-11
ThinkPHP6 使用JwtToken
ThinkPHP6 使用JwtToken1.安装JwtTokencomposer require firebase/php-jwt2.新建PHP类文件这里新建了Token.php类文件,用于token的签发和验证<?php namespace app\home; use Firebase\JWT\JWT; use Firebase\JWT\Key; class Token { protected $salt; protected $keyId; public function __construct() { $this->salt = md5("1585364631"); } function getToken($uid): string { $currentTime = time(); return JWT::encode([ "iss" => 'dao', "aud" => '', "iat" => $currentTime, "nbf" => $currentTime, "exp" => $currentTime + 3600 * 24, "data" => [ 'uid' => $uid, ] ], $this->salt, "HS256"); } public function checkToken($token): array { $res = array("code"=>201); try { JWT::$leeway = 60; $decoded = JWT::decode($token, new Key($this->salt, 'HS256')); return [ "code"=>200, "data"=>((array)$decoded)['data'] ]; } catch(\Firebase\JWT\SignatureInvalidException $e) { $res['msg']="签名不正确"; }catch(\Firebase\JWT\BeforeValidException|\Firebase\JWT\ExpiredException $e) { $res['msg']="token失效"; } catch(\Exception $e) { $res['msg']="token无效"; } return $res; } }3.新建中间件文件需要登入使用的进行校验<?php namespace app\home\middleware; use app\home\Token; use Closure; use think\Request; use think\Response; use think\response\Redirect; class UserToken { /** * 处理请求 * * @param Request $request * @param Closure $next * @return Response|Redirect */ public function handle(Request $request, Closure $next) { $token = $request->header('jwtToken',""); $res = (new Token())->checkToken($token); if ($res['code'] != 200 ){ return json($res); } $request->uid = $res['data']->uid; return $next($request); } }
2023年02月11日
422 阅读
0 评论
0 点赞