- 博客(72)
- 收藏
- 关注
原创 计算年龄年月日时分秒
function getRemainderTime($one_time, $two_time, $return_type=0, $format_array=array('岁', '个月', '天', '个小时', '分', '秒')) { if ($return_type < 0 || $return_type > 6) { return false; } if (!(is_int((int)$one_time)..
2022-03-17 14:29:18
409
原创 微擎远程附件七牛云上传
<?php //文件上传 服务器 从服务器转到七牛云 同时删除服务器文件$setting = $_W["setting"]["upload"]["image"];$compressed = !empty($_GPC["compressed"]) ? $_GPC["compressed"] : 0;$ext = '';switch ($_FILES["file"]["type"]) { case "application/x-jpg": case "image/jpeg":.
2022-02-18 15:54:45
572
原创 数组重新排序 根据某只字段
$res = []; foreach ($data as $ks => $vs) { $res[$vs['dtime']][] = $vs; }
2021-12-22 14:42:38
101
原创 微擎生成二维码
// 加载生成二维码需要用到的库load()->library('qrcode');// 生成二维码并保存$codes = time();$value =$codes;QRcode::png($value, IA_ROOT .'/addons/fanchun_usedcar/codes/' .$codes.'.png', $level=QR_ECLEVEL_L, $size=4.3, $margin=1,$saveandprint=false);$url="{$_W['siteroot'.
2021-12-16 18:37:10
394
原创 微信禁止分享
<script> function onBridgeReady() { WeixinJSBridge.call('hideOptionMenu'); } if (typeof WeixinJSBridge == "undefined") { if (document.addEventListener) { document.addEventListener('Weix.
2021-10-22 16:53:00
124
原创 防止点击事件重复点击请求
<script> var numm=0 function bz(index){ if(numm==1)return false; numm=1 $.ajax({ type:'POST', url:"", data:{}, async:false, success:function(res){ numm==.
2021-09-07 10:30:37
113
原创 微擎上传图片
<?php global $_W;global $_GPC;$weid = $_W["uniacid"];$setting = $_W["setting"]["upload"]["image"];// $return["msg"] = $_FILES;// echo json_encode($return);die;$datas['name']=$_GPC['name'];$datas['type']=$_GPC['type'];$datas['path']=$_GPC['pa.
2021-08-30 10:12:15
710
原创 根据已知数组分页
数组为 $arr; //前端传过来的页数,第几页 $page = $_GPC['page'];//第几页 从1开始 //开始取值的下标,数组下标是从0开始的,例如第一页从下标为0开始取,第二页从下标为10开始取 $start = ($page-1)*5; //根据开始的下标,和需要取的数据的条数(每页显示的条数)循环赋值给新数组 for ($i=$start;$i<$start+5;$i++){ if (!empty($arr[$i])...
2021-08-17 16:28:17
139
原创 合并数组 重新排序
1、合并数组$arr=array_merge_recursive($data,$data2,$data3......);2、数组重新排序 $flag = array();foreach($arr as $v){ $flag[] = $v['starttime'];}array_multisort($flag, SORT_DESC, $arr);array_multisort(array_column($user, 'count'), SORT_DESC, array_column(.
2021-08-17 16:14:02
150
原创 微擎中下载小程序画布生成的图片
PHP部分 load()->func('file');$file = $_FILES['file'];$id=$_GPC['id']; //文件夹路径$destination_folder = "../attachment/htimg/" . date('Ymd') . "/"; //上传文件路径 //如果不存在文件夹就创建if (!file_exists($destination_folder)) { mkdir($destination_folder.
2021-08-04 13:44:31
143
原创 微擎 发送模板消息
$template = array( 'touser' => "接收人Openid'", 'template_id' => "模板id", 'url' => '', 'topcolor' => "#FF0000", 'data' => array( 'first' => array( 'value' => urlencode('.
2021-07-30 10:02:50
403
原创 微擎记录日志
//载入日志函数 load()->func('logging'); //记录文本日志 logging_run('23232323'); //记录数组数据 logging_run(array('username' => '米粥', 'age' => '18'));结果:/data/logs[2021-07-28 15:44:19] trace /app/index.php?i=2&c=entry&do=ad...
2021-07-28 15:47:08
614
原创 SQL where条件中截取
数据库中starttime =2021-07-28 12:20 ":time" =2021-07-29"WHERE left(starttime,11)<=:time AND left(endtime,11)>=:time"left(starttime,11) 变成2021-07-28与time比较
2021-07-28 15:43:30
1052
原创 图片懒加载
<meta charset="UTF-8"> <meta name="viewport" content="width=device-width, initial-scale=1.0"> <meta http-equiv="X-UA-Compatible" content="ie=edge"> <title>图片懒加载</title> <style> img { ...
2021-07-21 14:22:30
110
原创 POST 、GET请求
public function geturl($url){ /** @var * * curl get请求封装,返回json数据格式数据 */ $headerArray =array("Content-type:application/json;","Accept:application/json"); $ch = curl_init(); curl_setopt($ch, CURLOPT_URL...
2021-07-19 16:49:08
83
原创 计算两个时间之间的日、时、分、秒
//功能:计算两个时间戳之间相差的日时分秒//$begin_time 开始时间戳//$end_time 结束时间戳function timediff($begin_time,$end_time){ if($begin_time < $end_time){ $starttime = $begin_time; $endtime = $end_time; }else{ $starttime = $end_time; ..
2021-07-07 13:47:06
544
原创 php使用正则表达式删除a标签
$str = "<div>小基炖蘑菇 <a href="//www.baidu.com">www.baidu.com</a></div>";$str = htmlspecialchars_decode($str);$str = preg_replace("/<a[^>]*>(.*?)<\/a>/is", "$1", $str);echo $str;//输出 <div>小基炖蘑菇 www.baidu.co.
2021-07-06 15:42:47
314
1
原创 PHP过滤数组中的0、null、false和‘‘等空值
$entry = array( 0 => 'foo', 1 => false, 2 => -1, 3 => null, 4 => '', 5 => 0 );print_r(array_filter($entry));输出Array( [0] => foo [2] =.
2021-07-06 15:38:39
203
原创 下载远程文件到指定目录
<!--?phpclass Download{ public static function get($url, $file) { return file_put_contents($file, file_get_contents($url)); } public static function curlGet($url, $file) { $ch = curl_init(); curl_setopt($ch, CURL.
2021-07-06 15:36:38
155
原创 GD库生成图片验证码
前台<!--?phpif(isset($_REQUEST["code"])){ session_start(); if(strtolower($_POST["code"])==$_SESSION["code"]){ echo "《script》alert('正确!')《script》"; }else{ echo "《script》alert('错误!')《script》"; }}?--> <me
2021-07-06 15:25:17
100
原创 小程序根据经纬度获取地址
小程序端前端wx.ready(function() {wx.getLocation({type: 'wgs84',// 默认为wgs84的gps坐标,如果要返回直接给openLocation用的火星坐标,可传入'gcj02'success: function (res) {var latitude = res.latitude; // 纬度,浮点数,范围为90 ~ -90var longitude = res.longitude; // 经度,浮点数,范围为180 ~ -180。
2021-07-05 15:49:21
329
原创 小程序获取手机号
WXBizDataCrypt.php<?php/** * 对微信小程序用户加密数据的解密示例代码. * * @copyright Copyright (c) 1998-2014 Tencent Inc. */include_once "errorCode.php";class WXBizDataCrypt{ private $appid; private $sessionKey; /** * 构造函数 * @p
2021-07-05 15:47:05
97
原创 飘窗 js、 html
<!DOCTYPE html><html lang="en"><head> <meta charset="UTF-8"> <meta name="viewport" content="width=device-width, initial-scale=1.0"> <title>飘窗</title></head><style> * { padding: 0; .
2021-07-05 15:42:12
256
1
原创 H5手机上一件发送短信模板
<a class="way_a1" href="sms:1835*******&body=您好我是公司安排{$order['times']} {$order['upcar']}为您服务的驾驶员,我会准时到达,请核对您的用车时间地址,收到请回复谢谢,班次{$item['banci']}"></a>...
2021-07-05 11:34:51
177
原创 微擎php发起支付
public function doMobilePay() { //金额数 $fee = floatval($_GPC['money']); if($fee <= 0) { message('支付错误, 金额小于0'); } //构造支付请求中的参数 $params = array( 'tid' => $chargerecord['tid'], //充值模块中的订单号 'ordersn' => $chargerecord['tid'], //订单号.
2021-07-02 16:25:28
217
3
原创 微擎js发起支付
<a href="#" class="flex btn-block btn-primary mui-btn mui-btn-block mui-disabled js-wechat-pay">提交订单</a>//mui-btn mui-btn-block mui-disabled js-wechat-pay 必须的class<script> window.sysinfo = { {if !empty($_W['uniacid'])}'un.
2021-07-02 16:22:40
211
原创 EFO 原样输出
$url = 'http://baidu.com';$js = <<<eof<script type="text/javascript">window.top.location.href = "$url?login";</script>eof;//此结束符前不要有任何空格echo $js;
2021-07-02 10:31:04
272
原创 php正确安装memcache扩展的方法
php正确安装memcache扩展的方法:1、下载memcache扩展;2、将扩展文件放入扩展目录下的ext目录下;3、编辑php.ini配置文件,开启memcache扩展模块;4、重启nginx。
2021-07-02 09:53:17
327
原创 php数组怎么去除重复值array_unique()
$a1=array("a"=-->"red","b"=>"green","c"=>"red");$a2=array("1"=>"Cat","2"=>"Dog","3"=>"Cat","4"=>"rabbit");var_dump(array_unique($a1));var_dump(array_unique($a2));array (size=2) 'a' => string 'red' (length=3) 'b' => str.
2021-07-01 16:48:58
124
2
空空如也
TA创建的收藏夹 TA关注的收藏夹
TA关注的人