php
Zzzz二哥
这个作者很懒,什么都没留下…
展开
-
Tp6 使用mongo 查询字段存在且不为空
【代码】【无标题】原创 2023-06-13 09:09:45 · 528 阅读 · 0 评论 -
Elasticsearch使用scroll_id游标 解决10000条数据限制
PHP Elasticsearch使用scroll_id游标 解决10000条数据限制。原创 2022-11-18 11:12:02 · 1185 阅读 · 0 评论 -
如何在docker容器中安装php自带的扩展模块
如何在docker容器中安装php自带的扩展模块转载 2022-11-02 11:16:57 · 5285 阅读 · 1 评论 -
Elasticsearch 字段录入中文之后,wildcard模糊查询只能单个字搜索,多个字搜索没有结果
Elasticsearch 字段录入中文之后,wildcard模糊查询只能单个字搜索,多个字搜索没有结果原创 2022-07-14 11:55:52 · 1635 阅读 · 0 评论 -
Redis 两个list 用新的list替换老的list 以及command keys must in same slot解决办法
redis list 'RENAME' command keys must in same slot原创 2022-06-20 15:50:02 · 932 阅读 · 0 评论 -
docker 配置nginx+php环境
https://www.cnblogs.com/rxbook/p/16090973.html转载 2022-04-13 10:54:49 · 467 阅读 · 0 评论 -
php 获取毫秒,一行代码搞定
intval(microtime(true)*1000);原创 2021-10-13 13:42:58 · 366 阅读 · 0 评论 -
curl json数据并获取返回响应头header信息
private static function curlJson($url, $data_string, $header = array() ) { $header[] = 'Expect:'; $header[] = 'X-AjaxPro-Method:ShowList'; $header[] = 'Accept: application/json,*/*'; $header[] = 'Content-Type: applicatio原创 2021-07-23 09:17:00 · 1071 阅读 · 0 评论 -
AES 密钥 各种长度
function keygen($length) { $token = ''; $tokenlength = round($length * 4 / 3); for ($i = 0; $i < $tokenlength; ++$i) { $token .= chr(rand(32, 1024)); } $token = base64_encode(str_shuffle($token)); return substr($token, 0.转载 2021-07-07 14:43:31 · 2438 阅读 · 0 评论 -
php7.2给每个数组元素加上前缀 create_function换成匿名函数
$imglist = explode('|',$detail['imgList']);$arr = array_map(function($item){return "https://img1.360buyimg.com/n1/$item";}, $imglist);原创 2020-11-20 16:13:33 · 279 阅读 · 0 评论 -
PHP 压缩图片尺寸 png做透明处理
//修改图片尺寸 png做透明处理//$imgsrc 要处理图片路径文件 $imgdst 生成图片路径文件 $new_width新的宽度 $new_height新的高度 public function compressedImg($imgsrc, $imgdst, $new_width, $new_height) { list($width, $height, $type) = getimagesize($imgsrc); switch ($type).原创 2020-09-01 11:21:25 · 455 阅读 · 0 评论 -
laravel Call to undefined method 1Illuminate\Database\Query\Builder::getForeignKeyName() or 1Illumin
vendor/laravel/framework/src/Illuminate/Database/Eloquent/Relations/BelongsTo.php 添加!!!!!!!public function getForeignKeyName(){ $segments = explode('.', $this->getQualifiedForeignKeyName()); return end($segments);}public function getQual.转载 2020-07-31 15:44:21 · 831 阅读 · 0 评论 -
MAC 安装PHP7.2 启动php-fpm NOTICE: fpm is running, pid 13487 NOTICE: ready to handle connections
php-fpm配置文件daemonize = no 修改为daemonize = yessudo php-fpmOK!原创 2020-07-30 15:52:30 · 4068 阅读 · 0 评论 -
PHP 取中文字之间的数字 (满4元减1元)
主要是判断淘宝的满减$str = "满4元减1元";$po1= (strpos($str,"满"));$po2= (strpos($str,"元减"));echo '取值:'.substr($str,$po1+3,$po2-3);取值:4原创 2020-06-11 14:47:43 · 152 阅读 · 0 评论 -
支付宝 APP支付
创建充值:public function createRechargeOrder(){ $mobile = $this->request->post('mobile')?$this->request->post('mobile'):0; $amount = $this->request->post('amount')?$this->request->post('amount'):0;//充值金额 $ty.原创 2020-05-09 10:34:07 · 568 阅读 · 0 评论 -
解决svn working copy locked问题
1.svn服务器运行svn cleanup2.提交改动 这时候会提示是什么问题 我的问题是 post-commit hook failed (exit code 1) with output: Conflict discovered in '........../pdd.php';3.svn服务器运行svn cleanup4.把文件回退到 没有修改的状态5.提交,现在就...原创 2020-04-24 10:28:32 · 197 阅读 · 0 评论 -
openssl_public_encrypt(): key parameter is not a valid public key
public key 不管一行还是 64个字符分行都会报这个错误。找了一下用这种方法成功了$public_key = "MIGfMA0GCSqGSIb3DQEBAQUAA4GNADCBiQ...";$public_key = "-----BEGIN PUBLIC KEY-----\n" . wordwrap($public_key, 64, "\n", true) . "\n---...原创 2020-04-14 14:13:05 · 6096 阅读 · 1 评论 -
php 生成6位随机字符串
/** * 生成随机字母加数字 字符串 * @param int $len 要生成字符串长度 * @param null $chars 要生成字符串包含的字符 * @return string 生成的字符串 */ public function getRandomString($len = 6, $chars = null) ...转载 2020-04-06 11:02:54 · 2294 阅读 · 0 评论 -
JSON 字符串和对象对比
$str = '{"extraMap":"{\"app\":\"activitylist.html\"}"}';var_dump(json_decode($str));$str1 = '{"extraMap":{"app":"activitylist.html"}}';var_dump(json_decode($str1));object(stdClass)#1 (1) { ["...原创 2020-03-23 18:26:03 · 300 阅读 · 0 评论 -
中文年月日 日期转成时间戳
$time = '2020年01月01日 00:00:00';public function dateToTime($format='Y年m月d日 H:i:s', $time){ $dt = date_create_from_format ( $format, $time); $data['start'] = date_timestamp_get($dt);//当天开始时间...原创 2020-01-07 10:47:04 · 1970 阅读 · 0 评论 -
Tp5 调用阿里云OSSsdk
<?php//阿里云oss存储namespace app\common\controller;vendor('aliyun-oss.autoload');use OSS\OssClient;use OSS\Core\OssException;class AliyunOss{ public $accessKeyId = ""; public $accessKeySecre...原创 2019-12-05 15:27:30 · 1136 阅读 · 0 评论 -
tp5 分页查询同时循环操作数据
Db::name('orders') ->where($map) ->order('create_time desc') ->paginate(50) ->each(function($item, $key){ //循环操作 return $item; });原创 2019-11-20 10:09:19 · 667 阅读 · 0 评论 -
苏宁佣金链接获取商品ID
$str = 'https://sugs.suning.com/C6cTlAxy';$content = file_get_contents($str);preg_match('/id="ga_itemDataBean_itemID" value="(\d*)"/', $content, $matches);var_dump($matches);$preg="/[^0]+.*/is";...原创 2019-11-06 10:22:26 · 1089 阅读 · 0 评论 -
PHP 含秘钥的可逆加密解密算法
// 加密算法function encrypt($data, $key){ $key = md5($key); $x = 0; $len = strlen($data); $l = strlen($key); $char = ''; $str = ''; for ($i = 0; $i < $len; $i++) { ...转载 2019-10-21 09:22:33 · 1670 阅读 · 0 评论 -
微信开发之上传素材
转载地址:https://www.cnblogs.com/hackbee/p/6859257.html猿声管理微信开发之上传素材本文目录 :上传图文素材的图片上传其他素材关键的http表单请求代码小结参考文档前言:我在实现微信公众平台上传素材的时候遇到了许多问题,但最终还转载 2018-02-01 15:51:11 · 371 阅读 · 0 评论 -
jQuery如何实现点击页面获得当前点击元素的id或其他信息
如下代码可以实现点击页面获得被点击元素的id123$(document).click(function(e) { // 在页面任意位置点击而触发此事件 $(e.target).attr("id"); // e.target表示被点击的目标})示例代码如下创建Html转载 2017-09-15 11:31:24 · 15600 阅读 · 3 评论 -
thinkphp自带的Page类 + Ajax实现无刷新分页 有视频教程和源文件
前端代码: {$vv.title} {$vv.content} {$page} $(function(){ $(".page a").live('click',function(){ //直接用click点击事件因为js没刷新还是会出现跳转,on(“click”,function)事件测试有的页码也会出现跳转 var page转载 2017-06-03 12:51:34 · 2808 阅读 · 0 评论 -
php下载功能
<?php $file_name = "57c79b825dbd8.jpg"; $file_dir = "/Upload/download/"; if (!file_exists($file_dir . $file_name)) { //检查文件是否存在 echo "文件找不到"; exit; } else { $file = fopen($file_dir . $f转载 2016-12-23 17:10:28 · 557 阅读 · 0 评论 -
Ubuntu 安装Phpstorm+汉化+激活
一、安装JDK因为phpstorm是一个Java程序,所以首先我们需要在Ubuntu上安装Oracle Java,最新的稳定版本是Oracle Java 8.我们将通过PPA进行安装。1、删除OpenJDK(如果之前有安装的话)sudo apt-get remove openjdk *2、添加PPA并使用以下3个命令安装Oracle Java 8。sudo add-apt-repository p...转载 2018-04-12 15:58:58 · 454 阅读 · 0 评论 -
Ubuntu composer安装lumen、laravel
1.安装composercurl -sS https://getcomposer.org/installer | php2.全局安装composersudo mv composer.phar composer sudo mv composer /usr/local/bin/3.命令行输入composer 查看是否安装成功 composer换国内镜像 c...原创 2018-07-02 15:32:16 · 687 阅读 · 0 评论 -
PHP 微信扫码支付模式二
1.微信配置就不多说了,看文档。2.我用的是phalcon框架写的。。 在微信支付控制器中引入微信的配置文件require_once "wxpay/lib/WxPay.Data.php";require_once "wxpay/example/WxPay.NativePay.php";require_once "wxpay/lib/WxPay.Api.php"; 1)先创建本地订单...原创 2018-07-10 15:08:24 · 783 阅读 · 0 评论 -
php 下载远程图片到本地(图片)
/** * @param $image 文件(数据库存储形式为2018/2018174760.jpg) * @param $imgName 重命名 */ public function downImg($image,$imgName) { $url = "http://xxx.com/Uploads/"; $file...原创 2018-11-27 13:06:43 · 786 阅读 · 0 评论 -
php 分割中文字符串(1个字,多个字)
/** * 分割中文字符串 * $str 字符串 * $count 个数 */ public function mb_str_split($str, $count){ $leng = strlen($str)/3; //中文长度 $arr = array(); for ($i=...原创 2018-11-27 13:08:06 · 7153 阅读 · 1 评论 -
PHP获取文件夹下的所有.png后缀的图片
$img_list = glob("./../public/img/haibao/*.png");原创 2019-03-27 15:09:51 · 1023 阅读 · 0 评论 -
tp5 读数据库的时候把时间戳格式字段改为日期格式
$result = Db::name("articles") ->alias('A') ->join('article_cate B', 'A.cate = B.id') ->where(["user_id"=>$this->user_id,"active"=>1]) ...原创 2019-05-21 17:13:46 · 3917 阅读 · 0 评论 -
php原生 出现要输出两条数据的情况的解决办法
<li> <div class="pbox"> <a class='ajax' href="products/pro1.html" title="2016秋季九款英伦风男童格子衬衫 特价品牌童装"> <div class="pic"><img src="images/pic5.jpg原创 2016-08-17 10:34:24 · 294 阅读 · 0 评论