随笔分类 -  php

php笔记
摘要:public function excelExport($filename, $header, $data, $excelName , $format = 'Xls') {// $format只能为 Xlsx 或 Xls $newExcel = new Spreadsheet(); //创建一个新的 阅读全文
posted @ 2025-04-11 15:58 pengcx 阅读(23) 评论(0) 推荐(0)
摘要: 阅读全文
posted @ 2021-12-08 17:37 pengcx 阅读(199) 评论(0) 推荐(0)
摘要:$arr = ["6","10"]; $newArr = json_decode('[' . join(',', $arr) . ']', true); var_dump($newArr); 阅读全文
posted @ 2021-12-08 16:01 pengcx 阅读(535) 评论(0) 推荐(0)
摘要:centos7 yum安装php7.2 清除历史版本 安装源 安装扩展包 安装完成以后,启动服务 清除历史版本为了防止centos上面发生php冲突,先清除历史版 yum -y remove php* 安装源安装php72w,是需要配置额外的yum源地址的,否则会报错不能找到相关软件包。php高版本 阅读全文
posted @ 2021-11-18 11:26 pengcx 阅读(200) 评论(0) 推荐(0)
摘要:function arrayUnset($arr, $key) { $newArr = []; foreach ($arr as $value) { if (isset($newArr[$value[$key]])) { //查看有没有重复项 unset($value[$key]); } else 阅读全文
posted @ 2021-02-20 10:49 pengcx 阅读(42) 评论(0) 推荐(0)
摘要:$where = function ($query) use ($map1, $map2) { $query->whereOr(function ($query) use ($map1) { $query->where($map1); })->whereOr(function ($query) us 阅读全文
posted @ 2020-10-16 14:10 pengcx 阅读(324) 评论(0) 推荐(0)
摘要:一维数组求差集 key值不能变化 比如 $a = ['01', '12']; $b = ['01', '02', '03', ....,'13'] $c = array_diff($b,$a)); 返回的结果为 array (size=11) 1 => string '02' (length=2) 阅读全文
posted @ 2020-10-14 18:15 pengcx 阅读(264) 评论(0) 推荐(0)
摘要:一、phpmailer 安装或者下载方式: 1、从 github 上下载: https://github.com/PHPMailer/PHPMailer/ 2、使用 composer 安装: composer require phpmailer/phpmailer 二、开启QQ相关服务 设置-》账户 阅读全文
posted @ 2020-09-09 17:45 pengcx 阅读(172) 评论(0) 推荐(0)
摘要:public function score() { $rateTotal = 25;//总评分人数 $rateScore = 7.5;//最终评分 10分制 $totalScore = intval($rateTotal * $rateScore / 2); //总评分 转化为5分制 $percen 阅读全文
posted @ 2020-09-08 16:07 pengcx 阅读(431) 评论(0) 推荐(0)
摘要:function sign_count(){ $cur_day = date('Ymd',time()); $arr = [ ['id' => 7, 'sign_time' => '20200907'], ['id' => 6, 'sign_time' => '20200905'], ['id' = 阅读全文
posted @ 2020-09-07 15:55 pengcx 阅读(261) 评论(0) 推荐(0)
摘要:public function simple_encode($string = '', $skey = 'tgmnvqufpg') { $strArr = str_split(base64_encode($string)); $strCount = count($strArr); foreach ( 阅读全文
posted @ 2020-04-08 11:50 pengcx 阅读(287) 评论(0) 推荐(0)
摘要:header("content-type:text/html;charset=UTF-8"); $length = mb_strlen($str);//mb_strlen($str)将一个多字节字符计为1个,详情见php手册 $array = []; for ($i = 0; $i < $lengt 阅读全文
posted @ 2020-03-02 18:21 pengcx 阅读(119) 评论(0) 推荐(0)
摘要:<?php $test=0; if($test==''){ echo '<br />在php中,0即为空'; //被输出 } if($test ''){ echo '<br />在php中,0即为空'; //不被输出 } if($test==NULL){ echo '<br />在php中,0即为空 阅读全文
posted @ 2020-02-27 09:40 pengcx 阅读(338) 评论(0) 推荐(0)
摘要:public $bonus;//红包 public $bonusNum;//红包个数 public $bonusMoney;//红包总金额 public $moneySingleMax;//单个红包最大限制 public $moneySingleMin;//单个红包最小限制 /** * redPackageService constructor. * @param int $bonusNum * 阅读全文
posted @ 2020-01-03 16:36 pengcx 阅读(1283) 评论(0) 推荐(0)
摘要:来源:https://www.cnblogs.com/tssc/p/10255590.html 目录 0.CGI的引入 1.关于CGI 1.1.什么是CGI? 1.2.CGI程序的工作原理 1.3.CGI程序的特点 1.4.CGI程序的应用领域 2.关于FastCGI 2.1.什么是FastCGI? 阅读全文
posted @ 2019-12-31 14:30 pengcx 阅读(312) 评论(0) 推荐(0)
摘要:php获取前一个小时的时间: $mtime= date("Y-m-d H:i:s", strtotime("-1 hour")); php获取前一天的时间: $mtime= date("Y-m-d H:i:s", strtotime("-1 day")); php获取三天前的时间: $mtime= 阅读全文
posted @ 2019-11-26 09:37 pengcx 阅读(2145) 评论(0) 推荐(0)
摘要:$arr = array( array( 'id' => 5, 'time' => '2018-01-05', 'order' => 1 ), array( 'id' => 3, 'time' => '2018-01-03', 'order' => 2 ), array( ... 阅读全文
posted @ 2019-11-06 09:39 pengcx 阅读(171) 评论(0) 推荐(0)
摘要:来源: https://www.jianshu.com/p/5b5c2131bff9 ps:要写完整域名www.xxxx.com 阅读全文
posted @ 2019-10-16 11:23 pengcx 阅读(389) 评论(0) 推荐(0)
摘要:来源:https://blog.csdn.net/cs729298/article/details/78559641 阅读全文
posted @ 2019-09-25 14:58 pengcx 阅读(530) 评论(0) 推荐(0)
摘要:set_time_limit(0); 阅读全文
posted @ 2019-09-23 10:12 pengcx 阅读(562) 评论(0) 推荐(0)