自定义博客皮肤VIP专享

*博客头图:

格式为PNG、JPG,宽度*高度大于1920*100像素,不超过2MB,主视觉建议放在右侧,请参照线上博客头图

请上传大于1920*100像素的图片!

博客底图:

图片格式为PNG、JPG,不超过1MB,可上下左右平铺至整个背景

栏目图:

图片格式为PNG、JPG,图片宽度*高度为300*38像素,不超过0.5MB

主标题颜色:

RGB颜色,例如:#AFAFAF

Hover:

RGB颜色,例如:#AFAFAF

副标题颜色:

RGB颜色,例如:#AFAFAF

自定义博客皮肤

-+
  • 博客(17)
  • 收藏
  • 关注

转载 thinkphp6.0 接口频繁限制

1.安装composer扩展composer require topthink/think-throttle2.在app/middleware.php设置return [\think\middleware\Throttle::class,];3.在 config/throttle.php 配置选项:// 中间件配置return [ // 缓存键前缀,防止键值与其他应用冲突 'prefix' => 'throttle_', // 缓存的...

2021-10-12 16:34:40 355

转载 递归CURD

//封装成类里面的方法//$data表示所有的记录组成的数组。&寻址增加查询效率。 public function getTree(&$data, $parentId = 0) { $tree = []; foreach($data as $k => $v) { if($v['pid'] == $parentId) { //父亲找到儿子 ...

2021-09-09 20:47:51 83

原创 百度智能云 应用验证图片是否合规

/** * 获取方法 * @param string $url * @param string $param * @return bool|string */function request_post($url = '', $param = ''){ if (empty($url) || empty($param)) { return false; } $postUrl = $url; $curlPost = $param; // 初.

2021-09-02 15:54:10 175

原创 百度只能云 第三方内容审核接口

1、将下载好的SDK解压放在public/static下2、引入接口路径require_once './static/lib/AipContentCensor.php';创建一个类 将代一下方法复制 返回json格式结果 在控制器调用const APP_ID = ''; //自己的百度智能云appidconst API_KEY = ''; //自己的百度智能云api keyconst SECRET_KEY = ''; //自己的百度智能云 secret key...

2021-09-01 19:48:01 618

原创 微信小程序 获取地址 经纬度

建立input框 建立点击shijiamap(e){wx.chooseLocation({latitude:0,success:ret=>{console.log(ret);this.setData({latitude:...

2021-08-29 22:04:09 247

转载 ob缓存简单实现页面静态化

<?php //接收新闻id,传统的方法查询数据库并显示数据 $id=intval($_GET['id']); //先判断该新闻对于的静态页面是否存在,如果有,则直接返回,如果 //没有,则查询 $html_file="news-id".$id.".html"; //filemtime($html_file)+30>=time() 保证文件是30秒有效 if(file_exists($html_file) && file...

2021-08-27 16:44:33 95

原创 tp6 pdo

PDO连接并插入数据 回去插入数据的id$res=new \PDO("mysql:host=localhost;dbname=1810","root","123456");dump($res);if($res->exec("insert into titles (title,text,type) values('无缝','无缝管如何被UR被别人和','1')")){ echo '插入成功'."<br>"; echo $res -> lastinsertid(

2021-08-27 14:27:34 313

原创 niginx负载均衡配置

本地server{ listen 8081;//自己设置 server_name _;//自己设置 location / { root html; index index_8081.html;//自己设置 } } server{ listen 8082;//自己设置 server_name _ ;//自己设置 location / { root html;...

2021-08-24 16:04:37 66

原创 es 基本操作 及 高亮显示 封装接口

安装Elasticsearch-php:composer require elasticsearch/elasticsearch高亮显示插件:composer require nunomaduro/collision //ES客户端链接 private $client; /** * 构造函数 * * MyElasticsearch constructor. */ public function __construct() {..

2021-08-13 20:36:55 252

转载 OSS 分片上传

<?phpif (is_file(__DIR__ . '/../autoload.php')) { require_once __DIR__ . '/../autoload.php';}if (is_file(__DIR__ . '/../vendor/autoload.php')) { require_once __DIR__ . '/../vendor/autoload.php';}use OSS\OssClient;use OSS\Core\OssExceptio.

2021-08-08 19:42:29 527

原创 敏感词 SDK配置 service

引入文件 require_once './static/lib/AipContentCensor.php';//自定义路径/* * 敏感词SDK * */const APP_ID = '';const API_KEY = '';const SECRET_KEY = '';public static function text($text){ $client = new \AipContentCensor(self::APP_ID, self::API_KEY, self.

2021-08-06 11:26:55 226

原创 jwt封装

jwt组件安装composer require lcobucci/jwt 3.3jwt封装<?phpnamespace tools\jwt; //命名空间use Lcobucci\JWT\Builder;use Lcobucci\JWT\Parser;use Lcobucci\JWT\Signer\Hmac\Sha256;use Lcobucci\JWT\ValidationData;/** * Created by PhpStorm. * User:

2021-08-05 20:50:50 198 1

转载 tp6 validate验证

快速生成验证器 比如php think make:validate User<?phpnamespace app\controller;use app\validate\User;use think\exception\ValidateException;class Index{ public function index() { try { $result = validate(User::class)->batch(true)->chec

2021-08-05 20:36:52 1067

原创 tp6 service层 OSS

在service 建立一个类 lib:use OSS\OssClient; public function ossUpload($fileName,$filePath) { // 阿里云主账号AccessKey拥有所有API的访问权限,风险很高。强烈建议您创建并使用RAM账号进行API访问或日常运维,请登录RAM控制台创建RAM账号。 $accessKeyId = config('Oss.aliyun.accessKeyId'); $.

2021-08-05 20:29:33 896

原创 thinkphp5/tp5 在控制器中使用验证器

$result = $this->validate( [ //需要验证的数据 'name' => 'ceshi' ], [ //验证的规则 'name' => 'require', ], [ //触发验证的提示语 'name' => '请填写公司名称', ]);if (true !== $result) { return json(['error' ...

2021-08-02 13:57:55 145

原创 gitee 上传合并

1、克隆 git clone 仓储地址 克隆之后一般在master分支(主分支)2、创建分支 git checkout -b test test为新分支名3、查看分支 git branch [-a] -a 为参数,中括号不需要输入,可以查看所有分支4、切换分支 git checkout test 切换到test分支5、查看当前修改文件 git status6、提交修改 git add . git ...

2021-07-10 08:55:22 509

原创 2021-07-08

thinkphp kanjia public function records(){ $id=4;//商品id $userid=13;//用户id $date=date('Y-m-d H:i:s'); $user=User::where('userid',$userid)->find(); $shop=Shop::where('id',$id)->find(); $degree=$shop['m

2021-07-08 19:18:24 84

空空如也

空空如也

TA创建的收藏夹 TA关注的收藏夹

TA关注的人

提示
确定要删除当前文章?
取消 删除