包含关键字 hk 的文章 - 空痕博客 - 编程技术分享
首页
小记
php
python
uniapp
前端
其他
机器人
QQ机器人
项目
功能库
应用
其他页面
友情链接
用户留言
联系空痕
热门文章
PHP搭建QQ机器人(QQ官方)
下载文件到指定文件夹
UTS引用原生jar包进行原生插件开发
欢迎回来 Typecho !
上传文件到夸克网盘python代码
标签搜索
uniapp
python
PHP
VUE
UTS
uniapp-x
模板
夸克网盘
html
APP
KongHen
机器人
QQ
ID3
pyinstaller
redis
Echarts
邮箱
js
lyear
发布
登录
注册
找到
13
篇与
hk
相关的结果
2025-10-16
Android Studio最新版汉化教程(2025年10月17日)
下载语言包插件 Android Studio没有官方的中文语言包,使用IntelliJ的代替 点击下载 修改插件信息 解压压缩包 打开文件夹,向下寻找,找到lib文件夹下的jar包 lib文件夾图片 解压jar包 找到META-INFO文件夹并打开 META-INFO文件夾图片 打开plugin.xml文件 修改版本号为你的Android Studio版本号 修改版本号图片 保存文件,并将解压出来的所有文件重新打包为zip 重新打包为zip图片 修改压缩包zip后缀为jar 修改后缀名图片 安装插件 打开Android Studio,选择从磁盘安装语言包插件 安装语言包图片 打开设置,搜索lang,找到Language and Region,修改语言为中文 修改语言图片 重启Android Studio即可 修改完成图片 参考内容 Android Studio 中文汉化教程 android studio导入中文包
安卓
KongHen02
10月16日
0
105
0
2025-10-13
完美解决请求跨域问题
问题说明 1. 什么是跨域问题? 跨域问题是由浏览器的同源策略(Same-Origin Policy)引起的一种安全限制。当网页尝试访问不同源(协议、域名、端口任一不同)的资源时,浏览器会阻止这种请求。 2. 同源策略定义 两个URL在以下三个方面完全相同时才属于同源: 协议(Protocol):http、https等 域名(Domain):www.example.com 端口(Port):80、443等 3. 常见的跨域场景 // 同源示例 http://example.com/app1 --> http://example.com/app2 // 同源 // 跨域示例 http://example.com --> https://example.com // 协议不同 http://test.example.com --> http://api.example.com // 域名不同 http://example.com:80 --> http://example.com:8080 // 端口不同4. 浏览器端表现 // 预检请求 Access to XMLHttpRequest at 'http://api.example.com' from origin 'http://test.example.com' has been blocked by CORS policy: Response to preflight request doesn't pass access control check: No 'Access-Control-Allow-Origin' header is present on the requested resource. // 正式请求 Access to XMLHttpRequest at 'http://api.example.com' from origin 'http://test.example.com' has been blocked by CORS policy: No 'Access-Control-Allow-Origin' header is present on the requested resource.跨域问题.png图片 跨域检测 跨域检测工具:跨域测试工具 解决方法 1. 服务端配置允许跨域(后端属于自己) 基于宝塔面板配置 最新版宝塔面板(11.0.0+) 最新版宝塔配置非常简单,直接在站点设置里开启允许跨域即可。 配置步骤: 打开宝塔面板“网站”,点击对应的站点 点击“其他设置” - “跨域访问CORS配置” - “状态” - 开启 - “保存” 即可 步骤演示图片 低版本宝塔面板(< 11.0.0) 低版本需要修改站点的配置文件,略微麻烦。 配置步骤: 打开宝塔面板“网站”,点击对应的站点 点击“配置文件”,添加以下内容即可 # 解决跨域问题--START add_header Access-Control-Allow-Origin *; add_header Access-Control-Allow-Methods GET,POST,OPTIONS,PUT,DELETE; add_header Access-Control-Allow-Headers DNT,User-Agent,X-Requested-With,If-Modified-Since,Cache-Control,Content-Type,Range,Authorization; add_header Access-Control-Expose-Headers Content-Length,Content-Range; location / { # 处理 OPTIONS 预检请求 if ($request_method = 'OPTIONS') { add_header Access-Control-Allow-Origin *; add_header Access-Control-Allow-Methods GET,POST,OPTIONS,PUT,DELETE; add_header Access-Control-Allow-Headers DNT,User-Agent,X-Requested-With,If-Modified-Since,Cache-Control,Content-Type,Range,Authorization; add_header Access-Control-Expose-Headers Content-Length,Content-Range; add_header Access-Control-Max-Age 1728000; add_header Content-Type text/plain; add_header Content-Length 0; return 204; } } # 解决跨域问题--END步骤演示图片 存在的问题 需要删除自己代码里的允许跨域配置,否则会出现跨域冲突,出现错误。 // 配置冲突 Access to XMLHttpRequest at 'https://test.khkj6.com/' from origin 'https://tool.khkj.xyz' has been blocked by CORS policy: The 'Access-Control-Allow-Origin' header contains multiple values '*, *', but only one is allowed.配置冲突图片 2. 使用代理(服务端不属于自己) 跨域是浏览器端检测请求不同源,对请求进行拦截,所以,只要不使用浏览器发送请求就可以解决。 使用自己同源的域名或配置了允许跨域的域名进行代理 以下提供最基础的php演示 $ch = curl_init(); // POST 数据 $postData = [ 'name' => '张三', 'email' => 'zhangsan@example.com', 'age' => 25 ]; curl_setopt_array($ch, [ CURLOPT_URL => "https://api.example.com/users", CURLOPT_RETURNTRANSFER => true, CURLOPT_POST => true, CURLOPT_POSTFIELDS => http_build_query($postData), // 表单格式 CURLOPT_HTTPHEADER => [ 'Content-Type: application/x-www-form-urlencoded', ] ]); $response = curl_exec($ch); $httpCode = curl_getinfo($ch, CURLINFO_HTTP_CODE); curl_close($ch); echo "状态码: " . $httpCode . "\n"; echo "响应: " . $response;使用非浏览器发送请求 在app、小程序等环境中,不会出现跨域问题。 3. 浏览器禁用安全策略(仅开发环境) --disable-web-security --user-data-dir=文件夹路径配置步骤: 以chrome浏览器为例 在任意位置创建一个文件夹(用于存储禁用安全策略的浏览器数据) 示例路径:C:\MyChromeDevUserData 完整代码:--disable-web-security --user-data-dir=C:\MyChromeDevUserData 复制文件夹路径 找到chrome的安装目录 为chrome.exe创建快捷方式 打开创建的快捷方式的属性 打开属性图片 在属性 - 目标后方添加代码 f0ad4e 修改目标路径图片 使用新建的快捷方式进入,不会触发跨域问题
其他
# PHP
# 跨域
# 浏览器
KongHen02
10月13日
0
53
0
2025-10-09
全新任务管理平台(流量主变现系统)开源
项目简介 项目结构 接口管理:PHP + Mysql 后台管理系统:Vue3 + ts + TDesign 任务单页:Vue3 小程序:uniapp + Vue2 变现说明 基础流程: 后台创建任务 复制任务链接 分享到社群或私域 用户打开任务页面 跳转到小程序观看广告 观看广告 下发奖励 收入说明 微信小程序官方广告收入 其他推广/广告收入 系统演示 演示站点 空痕任务管理系统 后台数据为静态演示数据,无法更改 演示图片 管理后台 控制台图片 任务单页 任务单页图片 小程序 小程序图片 安装教程 管理后台 安装依赖 npm install 构建项目 npm run build 新建站网站及数据库 推荐:PHP 8.0 推荐:Mysql 5.7 开启SSL(必须) 配置伪静态 location / { try_files $uri $uri/ /index.html; } location /api/ { if (!-e $request_filename) { rewrite ^/(.*)$ /$1.php last; } } 配置跨域 配置跨域教程 请参考第1种解决方法 导入数据库 导入/后台/数据库/task_dev_xma_run.sql到Mysql数据库 修改/后台/api/config.php 管理账户密码 JWT配置(密钥、过期时间) 数据库配置 上传后台代码 上传/后台/dist目录中的全部文件到网站根目录 上传/后台/api目录到网站根目录 任务单页 安装依赖 npm install 修改/任务单页/src/App.vue中的接口信息 修改后台地址 修改视频教程地址 构建项目 npm run build 新建网站 静态网站 开启SSL(必须) 上传任务单页代码 上传/任务单页/dist目录中的全部文件到网站根目录 小程序 使用HbuildX打开小程序 在manifest.json中获取新AppID 修改/pages/user/view中的后台地址 修改/pages/user/work中的二维码 发行到微信小程序 在微信开发者工具中上传代码 登录微信小程序后台配置 配置request合法域名 https://task.dev.xma.run(更改为自己的后台地址) https://www.duitang.com 配置downloadFile合法域名 https://c-ssl.duitang.com 配置明文scheme拉起此小程序 pages/user/view;pages/user/work 代搭建/教学 请联系微信:KongHen02 项目地址 GitHub
应用
# PHP
# uniapp
# VUE
# 小程序
# 开源
KongHen02
10月9日
10
246
2
2025-08-31
修复RuleApp在微信环境不能设置头像问题
问题说明: 问题:RuleApp在微信内无法获取用户头像,且用户无法设置 产生原因:微信修改用户信息获取规则 修复方法: 新增微信环境设置头像按钮 <!-- #ifdef MP-WEIXIN --> <button class="cu-btn bg-gradual-blue radius" open-type="chooseAvatar" @chooseavatar="avatarUpload"></button> <!-- #endif -->修改演示图片 修改avatarUpload函数,并新增uploadAvatarToSever函数 uploadAvatarToSever(path) { const uploadTask = uni.uploadFile({ url: that.$API.upload(), filePath: path, // header: { // "Content-Type": "multipart/form-data", // }, name: 'file', formData: { 'token': token }, success: function(uploadFileRes) { setTimeout(function() { uni.hideLoading(); }, 1000); var data = JSON.parse(uploadFileRes.data); //var data = uploadFileRes.data; if (data.code == 1) { // uni.showToast({ // title: data.msg, // icon: 'none' // }) that.avatar = data.data.url; that.avatarNew = data.data.url; localStorage.removeItem('toAvatar'); that.userEdit(); //console.log(that.avatar) } else { uni.showToast({ title: "头像上传失败,请检查接口", icon: 'none' }) } }, fail: function() { setTimeout(function() { uni.hideLoading(); }, 1000); } }) }, avatarUpload(data) { var that = this; var token = ""; if (localStorage.getItem('userinfo')) { var userInfo = JSON.parse(localStorage.getItem('userinfo')); token = userInfo.token; token = userInfo.token; } // #ifdef APP-PLUS || H5 base64ToPath(data) .then(path => { that.uploadAvatarToSever(path) }) .catch(error => { console.error("失败" + error) }) // #endif // #ifdef MP-WEIXIN const path = data.detail.avatarUrl that.uploadAvatarToSever(path) // #endif },修复结果: 修复后,在微信内编辑用户信息页面会有设置头像按钮,点击按钮会调用微信官方获取头像接口,选择微信头像或者设置其他头像接口,返回用户选择的头像临时路径,使用data.detail.avatarUrl获取临时路径,调用uploadAvatarToSever函数上传到服务器。 完整代码: GitHub - RuleApp(KongHen) 原项目地址: GitHub - RuleApp(buxia97)
uniapp
# uniapp
# RuleApp
# 规则之树
# 微信小程序
# GitHub
KongHen02
8月31日
0
93
0
2025-08-22
故障风格404页面
效果演示 点击查看在线演示 图片演示图片 完整代码 <!DOCTYPE html> <html lang="zh-CN"> <head> <meta charset="UTF-8"> <meta name="viewport" content="width=device-width, initial-scale=1.0"> <title>系统故障 - 404</title> <style> * { margin: 0; padding: 0; box-sizing: border-box; } body { background: #0a0a0a; font-family: 'Courier New', monospace; height: 100vh; overflow: hidden; display: flex; align-items: center; justify-content: center; color: #00ff41; cursor: crosshair; } .matrix-bg { position: absolute; width: 100%; height: 100%; opacity: 0.1; background: repeating-linear-gradient( 0deg, transparent, transparent 2px, #00ff41 2px, #00ff41 4px ); animation: scan 8s linear infinite; } @keyframes scan { 0% { transform: translateY(-100%); } 100% { transform: translateY(100%); } } .container { text-align: center; position: relative; z-index: 10; } .error-code { font-size: 120px; font-weight: bold; position: relative; display: inline-block; color: #fff; letter-spacing: 10px; animation: flicker 0.5s infinite alternate; } .error-code::before, .error-code::after { content: "404"; position: absolute; top: 0; left: 0; width: 100%; height: 100%; background: transparent; overflow: hidden; } .error-code::before { left: 2px; text-shadow: -2px 0 #ff00c8; animation: glitch-1 0.3s infinite ease-in-out alternate-reverse; clip: rect(44px, 450px, 56px, 0); } .error-code::after { left: -2px; text-shadow: -2px 0 #00ffff, 2px 2px #ff00c8; animation: glitch-2 0.3s infinite ease-in-out alternate-reverse; clip: rect(44px, 450px, 56px, 0); } @keyframes glitch-1 { 0% { clip: rect(31px, 9999px, 94px, 0); } 20% { clip: rect(112px, 9999px, 76px, 0); } 40% { clip: rect(85px, 9999px, 77px, 0); } 60% { clip: rect(62px, 9999px, 34px, 0); } 80% { clip: rect(97px, 9999px, 89px, 0); } 100% { clip: rect(53px, 9999px, 47px, 0); } } @keyframes glitch-2 { 0% { clip: rect(65px, 9999px, 119px, 0); } 20% { clip: rect(52px, 9999px, 74px, 0); } 40% { clip: rect(4px, 9999px, 78px, 0); } 60% { clip: rect(100px, 9999px, 19px, 0); } 80% { clip: rect(22px, 9999px, 98px, 0); } 100% { clip: rect(89px, 9999px, 113px, 0); } } @keyframes flicker { 0%, 19%, 21%, 23%, 25%, 54%, 56%, 100% { text-shadow: 0 0 5px #00ff41, 0 0 10px #00ff41, 0 0 20px #00ff41; } 20%, 22%, 24%, 55% { text-shadow: none; } } .error-message { font-size: 18px; color: #ff0040; margin: 20px 0; animation: pulse 2s infinite; text-transform: uppercase; letter-spacing: 3px; } @keyframes pulse { 0%, 100% { opacity: 1; } 50% { opacity: 0.3; } } .home-button { display: inline-block; padding: 15px 30px; margin-top: 30px; border: 2px solid #00ff41; background: transparent; color: #00ff41; text-decoration: none; text-transform: uppercase; letter-spacing: 2px; position: relative; overflow: hidden; transition: all 0.3s; font-family: 'Courier New', monospace; } .home-button:hover { color: #0a0a0a; box-shadow: 0 0 20px #00ff41; } .home-button::before { content: ''; position: absolute; top: 0; left: -100%; width: 100%; height: 100%; background: #00ff41; transition: left 0.3s; z-index: -1; } .home-button:hover::before { left: 0; } .noise { position: absolute; top: 0; left: 0; width: 100%; height: 100%; background: radial-gradient(circle, transparent 20%, rgba(255,255,255,0.03) 20.1%, transparent 21%), radial-gradient(circle, transparent 40%, rgba(255,255,255,0.03) 40.1%, transparent 41%); animation: noise 0.5s steps(10) infinite; pointer-events: none; } @keyframes noise { 0%, 100% { transform: translate(0); } 10% { transform: translate(-2px, -2px); } 20% { transform: translate(2px, 2px); } 30% { transform: translate(-2px, 2px); } 40% { transform: translate(2px, -2px); } 50% { transform: translate(-2px, -2px); } 60% { transform: translate(2px, 2px); } 70% { transform: translate(-2px, 2px); } 80% { transform: translate(2px, -2px); } 90% { transform: translate(-2px, -2px); } } .system-info { position: absolute; bottom: 20px; left: 20px; font-size: 12px; color: #666; font-family: monospace; animation: typewriter 3s steps(30) 1; } @keyframes typewriter { from { width: 0; } to { width: 100%; } } @media (max-width: 768px) { .error-code { font-size: 80px; } .error-message { font-size: 14px; } } </style> </head> <body> <div class="matrix-bg"></div> <div class="noise"></div> <div class="container"> <h1 class="error-code">404</h1> <p class="error-message">系统故障 - 页面失踪</p> <p style="color: #666; margin-top: 10px;">检测到异常活动,启动安全协议</p> <a href="https://www.khkj6.com" class="home-button">返回安全区</a> </div> <script> // 随机故障效果 setInterval(() => { document.body.style.filter = `hue-rotate(${Math.random() * 360}deg)`; setTimeout(() => { document.body.style.filter = 'none'; }, 100); }, 3000); // 鼠标追踪效果 document.addEventListener('mousemove', (e) => { const x = e.clientX / window.innerWidth; const y = e.clientY / window.innerHeight; const glitch = document.querySelector('.error-code'); glitch.style.transform = `translate(${x * 4}px, ${y * 4}px)`; }); </script> </body> </html>
前端
# 模板
# html
# 404
KongHen02
8月22日
0
96
0
1
2
3
下一页
易航博客