- 博客(71)
- 资源 (9)
- 问答 (2)
- 收藏
- 关注
原创 tp6 文件上传 大文件
$file[] = $filename; try { // 验证文件大小,名称等是否正确 validate(['file' => 'filesize:10M|fileExt:xls,xlsx']) ->check($file); // 将文件保存到本地 $savename = Filesystem::putFile('topic', $...
2022-05-07 15:19:27
940
原创 统计每天的均值 如果是16-18日 17号没有数据则用0补充
$list = aa::wherewhere(function (Query $q) use ($param){ $edate = $param['date'][1]." 23:59:59"; $q->whereBetween("add_time",[$param['date'][0],$edate]); }) ->field("DATE_FORMAT(add_time,'%Y-%m.
2022-04-16 17:44:31
244
原创 zip批量下载
/** * 批量下载二维码 * @throws DataNotFoundException * @throws DbException * @throws ModelNotFoundException */ function uploadBatchCert(){ $data = $this->request->only(['cert_ids']);//合格证ID数组 $data['cert_ids'] =.
2022-02-18 11:32:07
148
原创 IOFactory 在已有的excel文件里面追加数据
public function readyExcel($filename){ $inputFileName = $filename;//excel文件路径 date_default_timezone_set('PRC'); // 读取excel文件 try { $inputFileType = IOFactory::identify($inputFileName); $objReader = I.
2022-02-11 17:08:52
603
原创 tp中查看无限下级人员
$this->funF([$v['id']], $lists);private function funF($list, &$rest){ foreach ($list as $item) { $rest[] = $item; $this->funF($this->fun($item), $rest); }}public function fun($ids){ return User::where("invi.
2022-02-07 10:57:21
371
原创 where
$typeNumber = str_enhtml($this->input->get('typeNumber',TRUE));$skey = str_enhtml($this->input->get('skey',TRUE));$where = '(isDelete=0) and typeNumber="'.$typeNumber.'"';$where .= $skey ? ' and name like "%'.$skey.'%"' : '';
2022-02-07 10:55:52
198
原创 批量下载二维码
function uploadBatchCert(){ $data = $this->request->only(['cert_ids']);//合格证ID数组 $data['cert_ids'] = explode(',', $data['cert_ids']); $cert = CertificateModel::field('certificate_name, certificate_path') ->...
2022-01-27 14:57:11
868
原创 phpqrcode 生成二维码并将生成的二维码放在某个图片上并添加文字
public function downQrCode($productId) { header("Content-type:image/png"); $label = "扫描二维码领取礼品"; $qrPath = runtime_path('qrcode'); // 存在清空文件不存在创建目录 if (is_dir($qrPath)){ array_map('unlink', glob($qrP.
2022-01-27 14:54:57
2053
原创 tp6中使用PclZip实现二维码打包下载
//获得二维码图片路径$paths = a::where('order_id' , $id)->column('code_pic');$paths = array_map(function ($v){ return '.' . $v;} ,$paths);$_path = './upfile/zip/' . date("Ymd") . '/';is_dir($_path) or mkdir($_path , 0777 , true);$filename = $_path . u.
2021-09-22 16:27:46
195
原创 curl
$token = '11111'; $post_data = json_encode($data); $headerArray =array("Content-type:application/json;charset='utf-8'","Accept:application/json","token:$token"); $curl = curl_init(); curl_setopt($curl, CURLOPT_URL, $url..
2020-11-14 13:33:22
111
原创 获得每个设备每小时的均值
$sdate = date("Y-m-d H:00:00",strtotime("-1 hour")); $edate = date("Y-m-d H:00:00"); $device = DustDevice:: field("id,device_name,network_num") ->select() ->each(function ($item) use ($sdate, $edat.
2020-11-14 11:27:49
211
原创 tp5.1的where
$where = function (Query $query) use(&$data) { if (isset($data['soot_status']) and !empty($data['soot_status'])) { $query->where('m1.soot_status', $data['soot_status']); } $query->wh.
2020-07-09 15:38:48
467
1
转载 根据经纬度判断坐标点在哪个区域范围内(高德可用 别的没有测试)
$area = array( 0 => array( array('x'=>115.5225419, 'y'=>38.2166756), array('x'=>115.4841541, 'y'=>38.2174511), array('x'=>115.4828238,'y'=>38.2300603), array('x'=>116.448455,..
2020-07-09 15:33:07
3654
原创 tp5.1 角色授权
$data = request()->param(); if(empty($data['role_id'])){ return json(['code'=>1,'data'=>'','msg'=>'请先选择角色']); } $role = roles::find($data['role_id']); $ids = explode(',',$data['auth_ids']); $.
2020-05-28 15:01:45
315
原创 php mysql 读取今年到现在每个月的数据
$month=$this->getMonth(11); $rmonarr=[]; for($i=0;$i<count($month);$i++) { $mon=substr($month[$i], 5); if($mon == '01' |...
2019-12-30 11:03:48
470
原创 PHP 如果传值为空则检索全部的 传值则检索对应的值
if(is_numeric($data['he_status'])) { $status = $data['he_status']; $where .= " AND o.he_status = ".$status;}如果he_status 为空则where不存在 否则走where...
2019-11-22 11:06:41
241
原创 Mysql 获取设备表中每台设备的最近的一条信息
SELECT a.id,b.addtime,a.is_maintain,a.sig_name FROM aa a LEFT JOIN (SELECT d_id, MAX(addtime) addtime FROM bb GROUP BY d_id) b ON a.id = b.d_id ORDER BY a.id
2019-09-24 09:56:01
975
原创 mysql 实现每半个小时/每小时/每2小时获得一次均值数据
每半小时select avg(aa),addtime from (select pm25 , DATE_FORMAT( concat(date(addtime),' ',hour(addtime),':',floor( minute(addtime)/30 )*30) ,'%Y-%m-%d %H:%i') as addtime from bb where addtime >= ...
2019-09-23 14:28:23
2903
3
原创 前后端分离 前台传base64的图片 tp5.1.1进行处理
话不多说,直接上代码public function image(Request $request){ $param = $request->param();//目录的upload文件夹下 $up_dir = "uploads/".date('Ymd', time()) . "/"; //创建目录 if(!file_exists($up...
2019-09-15 19:33:33
2576
原创 tp5.1的基本总结
如果不是前后端分离 前台模板参数替换 在config/template.php中修改 // 标签库标签开始标记 'taglib_begin' => '{', // 标签库标签结束标记 'taglib_end' => '}', //模板参数替换 'tpl_replace_string' => array( ...
2019-09-05 09:29:00
240
原创 tp5实现企业向个人付钱(分享奖励为例)
本人是在支付成功后的nofity.php进行操作的:public下的notify.php中 require_once "cash.php"; $obj = array(); $obj['openid'] = “”; //奖励人的openid $obj['amount']...
2019-07-19 10:41:13
250
原创 tp5实现微信支付
首先将订单信息(或者金额)进行传值window.location.href = '/wxpay/pay_wechat.php?order_id=' + data然后在public/wxpay/pay_wechant.php中实现:<?php ini_set('date.timezone','Asia/Shanghai');header("Content-type:text...
2019-07-19 10:34:40
4317
1
原创 tp5实现微信分享
首先调用分享的php文件 jssdk.php 本人把这个放在extend的文件下的share/jssdk.(jssdk本人已上传到csdn的资源里 )jssdk的链接:https://download.youkuaiyun.com/download/zhangweiguangsunjiao/11340400use share\jssdk;然后在控制器的方法里面写:$jssdk = n...
2019-07-12 15:33:53
1997
原创 tp5实现微信登录
首先写一个链接 并判断当前页面是否登录过(目前是商品控制器)$redirect_url = urlencode('http://'.$_SERVER['HTTP_HOST'].'/wap/login/wx_login');$member_id = Cookie::get('member_id');//获取登录ID$setting = Db::table('setting')->wh...
2019-07-12 15:14:36
3688
原创 tp5 上传图片的实现
<td>网站logo:</td> <td> <img src="{$data.web_logo?'/'.$data.web_logo:'/static/Admin/assets/img/add_photo.png'}" ...
2019-07-01 09:49:06
1955
原创 tp5中引用vendor下的文件
require "../extend/PHPExcel/PHPExcel.php"; $objPHPExcel = new \PHPExcel();这样就可以引用phpexcel了。
2019-06-25 09:43:25
10185
3
原创 tp5中获得td里面的数据的值
<a rel="tooltip" title="删除" href="javascript:void(0)" postid="{$data.id}"> <i class="fa fa-remove"></i> </a&g...
2019-06-24 15:06:27
588
原创 tp5 生成二维码 (原生的 不用composer安装)
html页面 <img src="/wap/goods/verifty" onClick="this.src='/wap/goods/verifty?nocache='+Math.random()" style="cursor:hand" alt="点击换一张"/>点击图片可更换验证码在控制器中:public function verifty(){ s...
2019-06-18 11:02:39
466
原创 tp5 实现支出类型的搜索
支付类型:全部 邀请下单 分享controller控制器:$status = [ ['id'=>1,'name'=>'全部'], ['id'=>2,'name'=>'分享'], ['id'=>3,'name'=>'邀请下单'], ];if(!empty(...
2019-06-14 09:48:00
187
原创 tp5 通过imagefttext 写入文字水印
$bigImgPath = 'http://' . $_SERVER['SERVER_NAME'].'/'.$filename; //获得底图的路径 $img = imagecreatefromstring(file_get_contents($bigImgPath)); putenv('GDFONTPATH=' . realpath('.')); ...
2019-06-13 17:14:12
1520
原创 tp5 在控制器中使用layer提示
首先在application下的common.php或者自己文件的common.php 如application/wap/common.php 中写方法注意js和layer.js是自己的目录文件夹下 tp5默认路径是public 所以如果是在public下不用写publicfunction alert($msg='',$url='',$icon='',$time=3){ ...
2019-06-12 18:12:11
1353
原创 tp5活动生成二维码 使用微信扫一扫进行核销
首先每个活动生成不同的二维码 $hecode = $this->codes($insert_id);$result = Db::table('')->where("activity_id='$insert_id'")->update(["cancel_code" => $hecode]);codes的代码如下:public function codes(...
2019-06-12 18:04:45
4402
原创 tp5权限 简单的
首先创建管理员表 admin管理员表中有个role_id 角色表的id 创建角色表(role)还有一个权限表(auth)创建角色权限关联表(ruler_auth)从总后台将用户角色写入数据库 并将权限写入数据库 在角色列表授拳权限写入ruler_auth表中 然后在左侧菜单栏公共的部分写入判断 判断当前用户的角色 以及对应的权限 //获取管理员角色...
2019-06-10 09:42:37
1258
1
原创 tp5 实现微信朋友的分享
首先在页面引用jssdk.php文件我将文件是vendor/share/jssdk.phpuse share\jssdk; //引入文件 $jssdk = new JSSDK("",""); $signPackage = $jssdk->GetSignPackage(); $this->assign("signPackage"...
2019-05-11 11:29:34
949
原创 yii2.0 在列表MyGridView 中添加a标签并在新的页面中打开
注意 : 一样要加:'format' => 'raw',[ 'attribute' => 'good_url', 'headerOptions' => ['width' => '150'], 'format' =...
2019-05-05 14:47:51
843
原创 微信登录
$appid = ""; $appsecret = ""; $openid = $_GET['openid']; $url_goods = Cookie::get('url'); $url_token = "https://api.weixin.qq.com/cgi-bin/token?grant_type=client_cred...
2019-04-30 16:18:18
354
原创 php 导出excel表格 (以导出银行卡信息为例)
//设置内存 ini_set("memory_limit", "2048M"); set_time_limit(0); $objectPHPExcel = new \PHPExcel(); //设置表格头的输出 $objectPHPExcel->setActiveSheetIndex()->setCe...
2019-04-28 14:55:59
1041
php 二维数组 根据value值相同 给出提示那几个元素相同
2022-02-26
svn服务器用post-commit钩子实现自动部署代码到项目报错126
2017-09-19
TA创建的收藏夹 TA关注的收藏夹
TA关注的人