![](https://img-blog.csdnimg.cn/20201014180756927.png?x-oss-process=image/resize,m_fixed,h_64,w_64)
php
文章平均质量分 55
萧枫1
道之所在,心之所向。
展开
-
hyperf docker-compoose 安装 附带mongo安装 mongo php扩展
hyperf docker-compoose 安装 附带mongo安装 mongo php扩展原创 2022-09-30 11:14:14 · 603 阅读 · 1 评论 -
hyperf docker-compose 安装
version: '3'services: mysql: image: mysql:5.7 container_name: hdzs-mysql ports: - "33069:3306" volumes: - ./mysql/lib/mysql:/var/lib/mysql - ./mysql/my.cnf:/etc/mysql/conf.d/my.cnf environment: - TZ=Asia/Shan.原创 2021-08-13 11:18:30 · 394 阅读 · 0 评论 -
把元素插入到数组指定位置
public function arrInsert(array $arr, $index, $data){ $count = count($arr); if ($count <= $index) { $arr[] = $data; return $arr; }; for ($i = ($count - 1); $i >= 0; $i--) { $arr[($i + 1)] = $arr[$i]; .原创 2021-04-17 16:27:37 · 383 阅读 · 0 评论 -
php把图片转成圆形
public function circularImg($img, $savPath, $w = 0){ $src = imagecreatefromstring(file_get_contents($img)); //获取网络资源文件 if ($w == 0) { $wh = getimagesize($img); $w = $wh[0]; $h = $wh[0]; $w = min($w, $h); } .原创 2021-02-05 09:14:04 · 204 阅读 · 1 评论 -
正则笔记
只匹配汉字:/^[\x{4e00}-\x{9fa5}]+$/u匹配汉字和汉字符号:^[\x7f-\xff]+$/原创 2020-11-26 14:27:42 · 110 阅读 · 0 评论 -
laravel笔记
php artisan migrate:rollback 运行回滚时出现错误Class 'CreateWxUserTable' not found 执行composer dump像那样 rollback 失败,是因为这些migration类是没有命名空间的,不好自动加载,需要在vendor/composer的autoload_static.php等文件登记这个类名和路径,这样才能自动加载并执行rollback 执行composer du (等于composer dump)就是重新扫描所...原创 2020-10-21 20:04:07 · 102 阅读 · 0 评论 -
php 多个二维数组 根据关联数据进行拼接
public function test(){ $arr = [ 'a'=>['a',2], 'b'=>['b',3] ]; $arr2 = [ 'a'=>['a',5], 'b'=>['b',6] ]; $data = []; foreach ($arr as $key=>$val){ if ($arr2[$key]){ ..原创 2020-10-19 22:49:46 · 434 阅读 · 0 评论 -
php无限级分类
/** * 分类树, 支持无限级分类 * @param $data * @return array */public static function getTree($data){ $items = array(); foreach ($data as $v){ $items[$v['category_id']] = $v; } $tree = []; foreach ($items as $id=>$item){ .原创 2020-09-17 19:51:59 · 66 阅读 · 0 评论 -
php操作redis大全
PHP操作Redis常用技巧这篇文章主要介绍了PHP操作Redis常用技巧,结合实例形式总结分析了php针对redis的连接、认证、string、hash等操作技巧与注意事项,需要的朋友可以参考下本文实例讲述了PHP操作Redis常用技巧。分享给大家供大家参考,具体如下:一、Redis连接与认证 //连接参数:ip、端口、连接超时时间,连接成功返回true,否则返回false...转载 2019-12-04 10:26:32 · 162 阅读 · 0 评论 -
thinkphp5.0日志读取
/** * 返回文件名数组列表 * @return array */public function getDirFileName(){ $dir = ROOT_PATH.'runtime/log'; $data = scandir($dir); return $data;}/** * @param $filename 文件路径 * @param $t...原创 2019-11-27 16:37:16 · 1177 阅读 · 0 评论 -
前后台分离 nginx反向代理配置
server { listen 80; server_name url1; root /dist; index index.html; error_page 404 /index.html; location /api/{ expires 12h; if ($request_uri ~* "(ph...原创 2019-09-25 19:20:29 · 274 阅读 · 0 评论 -
php趣味成语答题,题库生成.
public function question(){ $idiom = $this->get_rand_idiom();//拿出随机成语 $arr_rand = $this->make_arr($idiom);//数组 $idiom_arr[] = $idiom; $data = S('IdiomStory'); f...原创 2019-07-22 15:38:56 · 670 阅读 · 0 评论 -
php交叉成语生成
public function question(){ $idiom = $this->get_rand_idiom();//拿出随机成语 $arr_rand = $this->make_arr($idiom);//数组 $idiom_arr[] = $idiom; $data = S('IdiomStory'); $quesion...原创 2019-07-18 16:10:46 · 966 阅读 · 0 评论 -
window10安装jdk和elasticsearch
第一步:win10下安装个jdk1.8链接:https://pan.baidu.com/s/1j5gOtLknV_eHJGHVNlMt1g 密码:r3f1第二步:配置环境变量win10中为“此电脑”,选择“属性”,打开“系统”对话框,点击“高级系统设置”标签。弹出“系统属性”对话框,选择系统属性下的“高级”标签。选择“启动和故障恢复”下的“环境变量(N)“按钮,打开“环境变量”对话框。...原创 2019-01-17 18:36:40 · 533 阅读 · 0 评论 -
centos7 php编译安装
1.下载源码wget -O php7.tar.gz http://cn2.php.net/get/php-7.1.1.tar.gz/from/this/mirror2.解压php7tar -xvf php7.tar.gz3.进入php目录cd php-7.1.14.安装依赖包yum install libxml2 libxml2-devel openssl openssl-dev...原创 2019-01-08 15:31:44 · 710 阅读 · 0 评论 -
swoole和hiredis库安装
到swoole官网下载相应版本的源码包,解压。使用phpizp生成configure: /data/server/php/bin/phpize (PHP的phpize地址)hiredis库安装 git clone https://github.com/redis/hiredis.gitmakesudo make installsudo ldconfig编译swoole...原创 2019-01-09 23:04:46 · 343 阅读 · 0 评论 -
php Mysqli 基础类库
<?php/*掌握满足单例模式的必要条件(1)私有的构造方法-为了防止在类外使用new关键字实例化对象(2)私有的成员属性-为了防止在类外引入这个存放对象的属性(3)私有的克隆方法-为了防止在类外通过clone成生另一个对象(4)公有的静态方法-为了让用户进行实例化对象的操作*/class ConnectMysqli{ //私有的属性 private st...转载 2019-02-26 18:56:26 · 434 阅读 · 0 评论 -
查询数据库某个字段的重复记录
select * from TableA whereb in(selectb from TableAgroupby b havingcount(b) > 1)获取重复数据function repeating_data($array) { $len = count ( $array ); for($i = 0; $i < $len...转载 2019-03-29 14:43:27 · 1749 阅读 · 0 评论 -
php 存储表情
private function userTextEncode($str){ if(!is_string($str))return $str; if(!$str || $str=='undefined')return ''; $text = json_encode($str); //暴露出unicode $text = preg_replace_callback...转载 2019-03-23 15:21:23 · 456 阅读 · 0 评论 -
优雅的重启php-fpm
首先查看php-fpm 进程ps -aux | grep phproot 14742 0.0 0.0 186456 5728 ? Ss Jul24 0:05 php-fpm: master process (/usr/local/php/conf/php-fpm.conf)nginx 14743 0.0 0.0 186728 7656 ? ...转载 2019-04-28 17:18:53 · 409 阅读 · 0 评论 -
php-fpm设置
一:系统环境 1 2 3 4 [machao@aiye log]$ cat/etc/redhat-release CentOS Linux release7.3.1611(Core) [machao@aiye log]$ uname-i x86_64 内存:64G 二:php-error.log路径...转载 2019-05-04 21:55:03 · 149 阅读 · 0 评论 -
Linux安装composer
curl -sS https://getcomposer.org/installer | phpmv composer.phar /usr/local/bin/composer 移动到bin,可以全局使用。laravel镜像composer config -g repo.packagist composer https://packagist.laravel-china.org...原创 2019-06-04 15:25:28 · 78 阅读 · 0 评论 -
php把媒体文件上传到微信服务器
/** * 上传临时素材,有效期为3天(认证后的订阅号可用) * 注意:上传大文件时可能需要先调用 set_time_limit(0) 避免超时 * 注意:数组的键值任意,但文件名前必须加@,使用单引号以避免本地路径斜杠被转义 * 注意:临时素材的media_id是可复用的! * @param array $data {"media":'@Path\filename.jpg'} * ...转载 2019-06-18 17:38:14 · 1497 阅读 · 0 评论 -
php成语十字交叉坐标
$arr = array( '0'=>'九死一生', '1'=>'南柯一梦', );$arr_rand1 = $this->make_arr($arr[0]);//数组$arr_rand2 = $this->make_arr($arr[1]);//数组for ($i=0;$i<count($arr_rand1);$i++){ ...原创 2019-07-18 16:07:14 · 244 阅读 · 0 评论 -
phpexcel表格 导出
import("Org.Util.PHPExcel"); $excel = new \PHPExcel(); $excel->getProperties()->setCreator("JAMES") ->setLastModifiedBy("JAMES") ->setTitle("zltrans") ->setSubj原创 2018-11-01 10:36:07 · 124 阅读 · 0 评论