thinkphp
昊喵喵博士
昊喵喵博士,欢迎大家一起来纠正和沟通问题(相互沟通是走向巅峰的一种捷径)
展开
-
ThinkPHP5怎么随机从数据库中查询几条数据
ThinkPHP5 怎么随机从数据库中查询几条数据原创 2022-10-19 16:00:46 · 1276 阅读 · 0 评论 -
thinkphp exp用法 必须搭配 Db::raw 用法
thinkphp exp用法 必须搭配 Db::raw 用法原创 2022-06-30 17:08:09 · 1298 阅读 · 0 评论 -
thinkphp6 tp6 类似tp5底层日志 代码
/** * 保存日志 * zh+ 2021-12-21 15:56 * */ public function saveLog($request){ $requestInfo = [ 'ip' => $request->ip(), 'method' => $request->method(), 'host' => $request->h...原创 2021-12-22 16:07:13 · 616 阅读 · 0 评论 -
thinkphp composer 第三方包引用 packagist 安装包 扩展
Packagist原创 2021-12-15 11:37:56 · 368 阅读 · 0 评论 -
mysql 查询附近店铺SQL写法 经度 纬度 范围 距离
查询最近10家注意我这里没用加limit,纯SQL记得加上SELECT * , round(2 * asin(sqrt(pow(sin((lat * pi() / 180 - $lat * pi() / 180) / 2),2) + cos(lat * pi() / 180) * cos($lat * pi() / 180) * pow(sin((lng * pi() / 180 - $...原创 2019-06-27 10:53:02 · 1096 阅读 · 1 评论 -
年月日 时分 时间间隔
/*查询当前剩余日期*/function selectdate(){ $j = 4; //获取当前月份天数 $start_time = strtotime(date('Y-m-d',time())); //获取本月第一天时间戳 $array = array(); for($i=0;$i<$j;$i++){ $date = date('Y-m-d',$start_time+$i*86400); $date_name = date('m月.原创 2021-11-15 14:31:30 · 159 阅读 · 0 评论 -
字体下载 ttf
https://www.dafont.com/原创 2021-11-03 16:20:54 · 1128 阅读 · 0 评论 -
php 图片合成
/*背景合成*/ //$back_img http链接 //$wx_code http链接 $dir_root = './uploads/uid2'; $first_dir = 'wechatcode/recruit_agent'; USER_ID = 1; $image_1 = imagecreatefrompng($back_img); $img_type = getimagesi.原创 2021-10-09 10:28:52 · 699 阅读 · 0 评论 -
根据经纬度算距离,返回结果单位是公里,先纬度,后经度
/** * 根据经纬度算距离,返回结果单位是公里,先纬度,后经度 * @param $lat1 * @param $lng1 * @param $lat2 * @param $lng2 * @return float|int */public function GetDistance($lat1, $lng1, $lat2, $lng2){ $EARTH_RADIUS = 6378.137; $radLat1 = $this->rad($lat1); $r.原创 2021-07-08 09:52:46 · 160 阅读 · 0 评论 -
php 时间展示 X天X小时X分钟 或者 00:00:00 时分秒
function timeCountdown($strtotime){ $time_text = ''; $day = (int)($strtotime/(86400)); $day_more = (int)($strtotime%86400); if($day>0){ $time_text = $time_text.$day.'天'; } $hour = (int)($day_more/(3600)); $hour...原创 2021-07-08 08:50:39 · 260 阅读 · 0 评论 -
php 延迟X分钟 取整点
/** * 向后延迟X分钟,取整点 * $delay 延迟分钟 * $time 格式 2020-01-05 02:05:00 * */function delayMinuteInt($delay=10,$time=''){// $time = '2021-06-23 11:34:00'; if(empty($time)){ $time = date('Y-m-d H:i:s',time()); } $after_time = (date('i',(.原创 2021-06-23 13:14:37 · 260 阅读 · 4 评论 -
php 下拉菜单选择 时间24:00格式
function timeLimit($step){ if (1440 % $step) { return []; } $time = []; for ($i = 0; $i <= 1440 / $step; $i++) { $hour = floor($i * $step / 60); $minute = $i * $step % 60; $time_time = ($hour >= 10 ? .原创 2021-06-22 12:24:55 · 172 阅读 · 2 评论 -
php 汉字转换成拼音
/** * 汉字转换成拼音 * @param $_String * @param string $_Code * @return string */function Pinyin($_String, $_Code = 'UTF8'){ $_DataKey = "a|ai|an|ang|ao|ba|bai|ban|bang|bao|bei|ben|beng|bi|bian|biao|bie|bin|bing|bo|bu|ca|cai|can|cang|cao|ce|ceng|cha" .原创 2020-07-31 16:03:18 · 309 阅读 · 0 评论 -
php 检测 手机号 座机号 身份证 邮箱
/** * 检测手机号 2017-10-15 */function isMobilephone($mobilehone = ''){ if (preg_match("/^1[3456789]{1}\d{9}$/", $mobilehone)) { return true; } else { return false; }}/** * 检验是否是座机号 * @param string $seat_number * @retur.原创 2020-07-31 15:10:44 · 590 阅读 · 0 评论 -
php thinkphp zip 图片 批量 下载 导出
//批量下载图片 public function batchDownload(){// $tdBookArchivesModel = new TdBookArchives;// $images = $tdBookArchivesModel->field('img')->select();//---------------------...原创 2019-06-27 10:58:09 · 888 阅读 · 0 评论 -
php thinkphp 将网络图片下载本地
$url = 'https://www.baidu.com/img/bd_logo1.png';$state = @file_get_contents($url,0,null,0,1);//获取网络资源的字符内容 if($state){ $filename = './'.rand(1000,9999).'.jpg';//文件名称与路径 o...原创 2019-07-12 16:45:34 · 1025 阅读 · 0 评论 -
php thinkphp 阿里云(国际版)短信发送 中国大陆和国外
阿里云(国际版)官方文档:https://www.alibabacloud.com/help/zh/doc-detail/106583.htm?spm=a2c63.p38356.b99.20.73517f303V0IAm注意:阿里云账号分(国内版、国际版),不同账号发送短信sdk不一样的下载sdk速度较慢,一定要耐心等待坑点一:国际版下载sdk是通过composer命令下载的(也有其他方式,本人未试),如果你使用的是TP框架,通过composer命令下载,可能会与你框架的【composer.js原创 2020-07-31 09:54:56 · 1977 阅读 · 0 评论 -
七牛云 amr 转 MP3 转码
public function QiniuChangeFile($card_id){ $filePath = "./uploads/uid2/wechat/" . $card_id . ".amr"; //本地文件路径 $accessKey = ""; //七牛公钥 $secretKey = ""; //七牛私钥 ...原创 2020-04-17 13:53:39 · 886 阅读 · 0 评论 -
php 阿里云 批量 单个 发送短信 (拿来即用)
官方: 错误码解析文档:https://help.aliyun.com/knowledge_detail/57717.html?spm=5176.11065259.1996646101.searchclickresult.2b5c60d4XBpIKC&aly_as=ytfSoeY- 短信文档:https://help.aliyun.com/do...原创 2019-12-24 15:20:23 · 1584 阅读 · 0 评论 -
php 城市列表 字母查询
//调用方法 public function InitialscityList(){ // 按首字母排序 查询 $china_city = ChinaCity::where('status',0)->select()->toArray(); $data = $this->groupByInitials($ch...原创 2019-02-25 15:58:24 · 819 阅读 · 2 评论 -
ThinkPHP5.1阿里云短信服务分享
使用方法//短信发送 public function trySms(){ $mobile = input('mobile'); $data = db('config')->where('inc_type','sms')->select(); $config = convert_arr_kv($data,'name','value'); /...翻译 2019-02-25 16:38:27 · 1030 阅读 · 0 评论 -
基于THINKPHP5 使用webuploader 大文件分片上传合并
基于THINKPHP5 使用webuploader 大文件分片上传合并今天用到大文件上传,使用了百度的webuploader分片上传下面发一下我的方法,以便往后用到使用首先引入JQ,以及webuploader插件文件 css及js<script src="/public/others/jquery.js"></script><script src...转载 2019-03-03 21:49:52 · 2465 阅读 · 0 评论 -
php 智能识别收货地址
public function apiAnalysisPublic($analysis){ $str = $analysis; $patt = '/1[2345678]\d{9}/'; preg_match ($patt,$str,$phone); if(empty($phone)){ return 10...原创 2019-05-16 08:56:58 · 1843 阅读 · 0 评论 -
php 音频数据流 base64 生成文件 视频
public function saveFileVideo() { $file = input('post.file'); $file = substr(strstr($file,','),1); $base_img = str_replace('data:image/jpg;base64,', '', $file);// 设置文件路径...原创 2019-07-19 10:21:37 · 2937 阅读 · 0 评论 -
thinkphp join关联 表前缀
将第一个参数修改为 数组类型join(['fc_agency' => 'a'],'a.id = f.agent','LEFT')join(['fc_fans' => 's'],'f.fans = s.id','LEFT')原创 2019-08-23 14:40:22 · 891 阅读 · 0 评论 -
TP5.1的No input file specified解决办法 之一(防跨站原因之一)
WINDOWS + APACHE + PHP 5.6.27 环境,TP5.1报No input file specified.错误。本来以为常规操作在index.php加上?就能解决的事情,居然没效果了。。#常规操作 RewriteRule ^(.*)$ index.php/$1 [QSA,PT,L]改为RewriteRule ^(.*)$ index.php?/$1 [QS...转载 2019-08-28 09:53:54 · 2301 阅读 · 0 评论 -
thinkphp 5.0.12 实例化模板后 select toArray报错
如果设置了模型的数据集返回类型的话,则可以简化使用<?phpnamespace app\index\model;use think\Model;class User extends Model{ protected $resultSetType = 'collection';}https://www.kancloud.cn/manual/thinkphp5/...翻译 2019-02-25 15:50:55 · 804 阅读 · 0 评论