随笔分类 -  PHP

摘要:1. 验证码接口 $captcha = captcha(); $data['data'] = [ 'img' => "data:image/png;base64," . base64_encode($captcha->getData()), 'key' => uniqid() ]; $data['s 阅读全文
posted @ 2024-05-21 13:30 _迷途 阅读(375) 评论(0) 推荐(0)
摘要:以下是我在项目中常用的.gitignore文件: # 目录 /.idea/ /.vscode/ /vendor/ /runtime/ /thinkphp/ /public/uploads/ /public/upload/ /__MACOSX/ public/.well-known/ # 文件 Thu 阅读全文
posted @ 2024-01-03 15:27 _迷途 阅读(315) 评论(0) 推荐(0)
摘要:putenv('HTTPS_PROXY=127.0.0.1:10809'); putenv('HTTP_PROXY=127.0.0.1:10809'); 阅读全文
posted @ 2023-04-11 16:46 _迷途 阅读(30) 评论(0) 推荐(0)
摘要:我的PHP版本是7.4,起他版本没有试过 下载composer.zip 解压,把里面的composer文件复制这个文件到容器里的这个路径:/usr/local/bin/ 赋权限chmod 775 composer 如果composer install速度太慢,换源,我用的是阿里云镜像 compose 阅读全文
posted @ 2023-03-31 01:39 _迷途 阅读(163) 评论(0) 推荐(0)
摘要:来源:https://stackoverflow.com/questions/1361925/how-to-enable-socket-in-php 执行: docker-php-ext-install 扩展 docker-php-ext-configure: This command allows 阅读全文
posted @ 2023-03-31 01:16 _迷途 阅读(47) 评论(0) 推荐(0)
摘要:我发现修改.env文件里的APP_TRACE=false仍然无法关闭页面右下角的调试图标 1.创建一个类app/common/libs/NullTrace.php <?php namespace app\common\libs; use think\App; use think\Response; 阅读全文
posted @ 2023-03-17 10:50 _迷途 阅读(344) 评论(0) 推荐(0)
摘要:/.idea/ /.vscode/ /vendor/ /runtime/ /public/uploads/ /public/upload/ /.DS_Store/ /thinkphp/ *.log .env .DS_Store .htaccess /public/.htaccess .user.in 阅读全文
posted @ 2023-03-16 17:01 _迷途 阅读(186) 评论(0) 推荐(0)
摘要:php think build --module test 新建一个test应用 阅读全文
posted @ 2023-03-01 13:52 _迷途 阅读(26) 评论(0) 推荐(0)
摘要:/** * 通过数据库的方式递归查询当前分类ID的所有子分类ID * @param $id * @return array * @throws DataNotFoundException * @throws DbException * @throws ModelNotFoundException * 阅读全文
posted @ 2022-12-23 23:26 _迷途 阅读(150) 评论(0) 推荐(0)
摘要:/** * 通过数据库递归的方式查找当前分类ID的所有上级ID * @throws ModelNotFoundException * @throws DbException * @throws DataNotFoundException */ public function findAllParen 阅读全文
posted @ 2022-12-23 23:13 _迷途 阅读(122) 评论(0) 推荐(0)
摘要:thinkphp/library/think/route/Rule.php 第794行,增加这段代码: elseif (is_array($route) && count($route) == 2) { $result = $this->dispatchMethod($request, $route 阅读全文
posted @ 2022-12-22 10:39 _迷途 阅读(72) 评论(0) 推荐(0)
摘要:企业微信群机器人说明文档:https://developer.work.weixin.qq.com/document/path/91770。利用群机器人有个优点,在程序哪里经常抛出异常,就可以在第一时间知道。 Python3: import json import requests from dat 阅读全文
posted @ 2022-12-14 09:30 _迷途 阅读(324) 评论(0) 推荐(0)
摘要:首先: composer require topthink/think-captcha v3.0.8 把这张图片下载,后缀名png改成zip,解压到: vendor/topthink 阅读全文
posted @ 2022-12-13 14:55 _迷途 阅读(66) 评论(0) 推荐(0)
摘要:composer require topthink/think-filesystem 阅读全文
posted @ 2022-12-13 11:02 _迷途 阅读(610) 评论(0) 推荐(0)
摘要:首先开启多应用的方法: composer require topthink/think-multi-app 定义路由: <?php use think\facade\Route; Route::any('/user/login', '\\app\\index\\controller\\User@lo 阅读全文
posted @ 2022-12-03 22:20 _迷途 阅读(466) 评论(0) 推荐(0)
摘要:Particle\Validator是一个小巧优雅的实用的PHP验证类库,提供了一个非常简洁的API。它无需依赖其他组件,提供友好的文档,并且有利于扩展。 composer require particle/validator use Particle\Validator\Validator; $v 阅读全文
posted @ 2022-11-24 16:20 _迷途 阅读(119) 评论(0) 推荐(0)
摘要:<?php function formatNum(int $time) { if ($time < 10) { return "0{$time}"; } return $time; } function changeTimeType(int $num): string { $millisecond 阅读全文
posted @ 2022-11-16 19:54 _迷途 阅读(273) 评论(0) 推荐(0)
摘要:<?php function formatNum(int $time) { if ($time < 10) { return "0{$time}"; } return $time; } function changeTimeType(int $num): string { $millisecond 阅读全文
posted @ 2022-11-15 13:38 _迷途 阅读(64) 评论(0) 推荐(0)
摘要:<?php namespace app\admin\validate; use think\validate; class VideoKeywords extends validate { protected $rule = [ 'keyword' => ['require', 'unique' = 阅读全文
posted @ 2022-07-28 17:23 _迷途 阅读(155) 评论(0) 推荐(0)
摘要:SELECT CAST(id AS char) AS id FROM `table_name` 我也不知道为啥会导致自动四舍五入,有知道的吗? 阅读全文
posted @ 2022-07-15 16:09 _迷途 阅读(56) 评论(0) 推荐(0)