php
江江江I
雨一直下
展开
-
商家转账到零钱 设置ip
微信商户平台设置ip原创 2023-01-03 13:41:00 · 233 阅读 · 0 评论 -
微信支付证V3
微信支付V3原创 2022-08-18 11:06:05 · 576 阅读 · 0 评论 -
thinphp5.1以上查看thinphp版本号
dump( \think\facade\App::version());die;原创 2021-09-09 10:54:06 · 62 阅读 · 0 评论 -
phpWord
开发框架: thinkphp3.2Word插件: PHPWord一、安装PHPWord安装PHPWord,可以通过下面2中方式: 1. git地址下载:https://github.com/PHPOffice/PHPWord,下载完成后将文件复制到项目目录下 2. 使用composer安装::composer require phpoffice/phpword二、在项目中引入PHPWord2.1 在项目根目录的index.php文件中,加入以下代码,加原创 2021-06-19 13:43:26 · 1301 阅读 · 2 评论 -
tp5创建和调用存储过程
无参的Db::query(“call do_it(@res)”);$procedureRes = Db::query(“select @res as res”);do_it 存储过程名字@res 返回值名字带参的$userid = 100;res=Db::query("calldoit(res = Db::query("call do_it(res=Db::query("calldoit(userid)");...原创 2021-05-26 15:54:48 · 615 阅读 · 0 评论 -
获取下个月的今天 php
/* * 获取下个月的今天 * 如果 $date = 2018-1-31 二月没有31号 则获取二月份的最后一天 返回值为2018-2-28 * 如果 $date = 2018-1-15 返回值为2018-2-15 * * */ function getNextMonthDays($date){ $firstday = date('Y-m-01', strtotime($date)); $lastday = strtotime("$firstday +2 month -1 day").原创 2021-04-26 13:01:24 · 290 阅读 · 0 评论 -
公众号推送小程序卡片时需要的thumb_media_id
public function uploadTempMedia(){ $realurl = realpath("./").'\images\2.png'; $access_token = $this->getAccessToken(); $curl = "https://api.weixin.qq.com/cgi-bin/media/upload?access_token={$access_token}&type=image"; $result = $this->.原创 2021-03-27 14:28:19 · 1828 阅读 · 0 评论 -
公众号推送小程序卡片
首先公众号需要开通客服功能,没有的在公众号插件里添加//验证signature/*$signature = $_GET["signature"];$timestamp = $_GET["timestamp"];$nonce = $_GET["nonce"];$echostr=$_GET["echostr"];$token = "TOKEN"; //这里个token 需要跟公众号配置的一直才能通过验证 ,验证通过就可以注释掉了$tmpArr = array($token, $timestamp原创 2021-03-27 14:24:15 · 1595 阅读 · 0 评论 -
微信新增永久素材
//新增永久素材 public function addPermanentAssets(){ $media_id = $this->getPermanentMediaID(); $jsonArr = array( "articles"=> array( array( "title"=> 'hello word', "thumb_media_id"=> $media_id, "author"=> 'martin', "di.原创 2021-03-27 13:50:39 · 97 阅读 · 0 评论 -
微信新增临时素材
//新增临时素材 public function addNewTemporaryMaterialsn(){ $realurl = realpath("./").'\images\1.png'; //绝对路径 D://项目//upload/\images\1.png $access_token = $this->getAccessToken(); $curl = "https://file.api.weixin.qq.com/cgi-bin/media/upload?access_tok原创 2021-03-27 13:45:53 · 275 阅读 · 0 评论 -
PHP 生成随机多位序号 查询数据库
public function getCode(){ do{ $code = rand_string(12, 1); $repeat_code = $this->find(array('where' => array('code' => $code))); }while(!empty($repeat_code)); return $code; }原创 2021-03-23 10:25:23 · 112 阅读 · 0 评论 -
php 获取当前时间的 前后一小时、一天、一个月、一年
//获取本月起始日期$begindate=date(‘Y-m-01’, strtotime(date(“Y-m-d”)));enddate=date(′Y−m−d′,strtotime("enddate =date('Y-m-d', strtotime("enddate=date(′Y−m−d′,strtotime("begindate +1 month -1 day"));//获取一年前的日期$begindate= date(‘Y-m-d’, strtotime(date(‘Y-m-01’) .原创 2021-01-20 14:10:24 · 1355 阅读 · 0 评论 -
Laravel with 多表查询条件筛选(按从表查询)
例如以下表:菜品表: foods字段说明id主键title菜品名称.....菜品规格表: foods_specs字段说明id主键title规格名称foods_id菜品表IDprice价格.....省略菜品模型: FoodsModelclass FoodsModel extends Model{ // 省略 /** *...原创 2021-01-15 08:44:48 · 2405 阅读 · 0 评论 -
workman
https://github.com/walkor/workerman-chat原创 2021-01-08 08:10:05 · 75 阅读 · 0 评论 -
with
imageUsersInfos=images::with(′imageable′=>function(imageUsersInfos = images::with('imageable' => function(imageUsersInfos=images::with(′imageable′=>function(q){$q->select(‘id’,‘phone’);})->where(‘imageable_type’, ‘App\User’)->get();查询一原创 2021-01-05 10:16:44 · 72 阅读 · 0 评论 -
laravel查询排序
orderBy(‘created_at’,‘desc’)原创 2021-01-04 10:05:59 · 1194 阅读 · 0 评论 -
Laravel 条件数组 in 的用法
$where = [ ['status', '=', 1], ['name' , '>', 1] ];$ids = [1,2,3];$where[] = [function($query) use ($ids){ $query->whereIn('id', $ids);}];$list = User::where($where) ->get();原创 2020-12-31 11:32:15 · 1082 阅读 · 0 评论 -
Maatwebsite / Laravel-Excel 3.1(只适用3.1以上)
1.安装composer require maatwebsite/excel2.该Maatwebsite\Excel\ExcelServiceProvider是自动发现,并在默认情况下注册,但如果你想自己注册它:添加 ServiceProvider config/app.php‘providers’ => [/** Package Service Providers…*/Maatwebsite\Excel\ExcelServiceProvider::class,]3.添加 Fa原创 2020-12-30 14:40:30 · 390 阅读 · 0 评论 -
laravel excel 导出导入
laravel-excel教程手册链接laravel-excel Github链接原创 2020-12-30 09:25:50 · 79 阅读 · 0 评论 -
Composer提示:Installation failed, reverting ./composer.json to its original content.错误的解决办法
composer dump-autoloadcomposer update原创 2020-12-29 21:16:19 · 1546 阅读 · 0 评论 -
Class ‘Illuminate\Foundation\Application‘ not found Laravel
omposer update --no-scripts原创 2020-12-29 20:53:02 · 873 阅读 · 1 评论 -
Laravel 大数据量分块处理
DB::connection('sqlsrv')->table('表名')->select(array('字段1','字段2')) ->chunkById(100, function ($reslut) { var_dum($reslut); },'查询排序id');原创 2020-12-28 14:25:13 · 397 阅读 · 0 评论 -
laravel配置sqlsrv
1。在 config 下 database.php 里添加以下代码 'sqlsrv' => [ 'driver' => 'sqlsrv', 'url' => env('DATABASE_URL'), 'host' => env('DB_HOST_SRV', 'localhost'), 'port' => env('DB_PORT_SRV', '1433'), 'database' =>原创 2020-12-28 14:19:51 · 655 阅读 · 0 评论 -
Laravel自定义error log
1.config\logging.php2. ‘errorlog_test’ => [‘driver’ => ‘daily’,‘path’ => storage_path(‘logs/errorlog_test.log’),‘level’ => ‘debug’,‘days’ => 14,],3.调用方式Log::channel(‘errorlog_test’)->info(‘test’);...原创 2020-12-28 10:33:34 · 398 阅读 · 0 评论 -
php将图片链接直接转化为base64编码
/** 把网络图片图片转成base64* @param string img图片地址∗@returnstring∗//∗网络图片转为base64编码∗/publicfunctionimgtobase64(img 图片地址 * @return string */ /*网络图片转为base64编码*/ public function imgtobase64(img图片地址∗@returnstring∗//∗网络图片转为base64编码∗/publicfunctionimgt原创 2020-12-25 09:49:29 · 511 阅读 · 0 评论