php
小璐謌.
世界太大 过好当下
展开
-
think-queue+supervisor 常驻进程队列处理
一、错误的解决方法遇到“Another program is already listening on a port that one of our HTTP servers is configured to use.”这个报错是因为Supervisor已经启动了,这个时候如果想要解决这个问题,最简单的方法自然是 kill 掉进程,然后重启。首先查看进程号:ps aux | grep supervisord然后 kill 即可。但是这个方法并不优雅,如果想让新的配置文件生效,...原创 2020-12-10 15:45:32 · 744 阅读 · 0 评论 -
ip2long
<?php$ip = '192.168.0.1';$v = ip2long($ip); //ip转为整型echo long2ip($v); //整型转为ip?>注意:ip转为整型后(有符号整型),是负的sprintf(“%U”,ip2long($ip));可转化为正整数解决方案:(出现负数及解决方案)<?php$ip = '192.168.101.100';$ip_long = ...原创 2018-05-03 21:32:22 · 805 阅读 · 0 评论 -
"Vue单页式应用(Hash模式下 '/#/')分享出来的链接点开是首页”问题解决
问题:vue组件开发项目中,商品详情页微信转发url,例如:http://wap.wsguwancheng.com/#/productlists/688。自定义分享的链接被微信端截掉,变成http://wap.wsguwancheng.com/?from=singlemessage解决方案:页面中转,url重定向。1,在static目录下新建一个名为html的文件夹,在html文件夹中再新...原创 2018-08-02 14:21:56 · 6709 阅读 · 8 评论 -
str_pad() php 生成藏友编号
藏友编号 : HQ00000003$maxid = Db::name('users')->max('user_id');$map['numbers'] = 'HQ'.str_pad(($maxid+1),8,'0',STR_PAD_LEFT) str_pad(string,length,pad_string,pad_type)str_pad() 函数把字符串填充为新的长...原创 2018-08-08 12:01:52 · 298 阅读 · 0 评论 -
HP性能优化利器:对象迭代生成器 yield理解
协程:就是在单线程中使用同步编程思想来实现异步的处理流程,从而实现单线程能并发处理成百上千个请求,而且每个请求的处理过程是线性的,没有使用晦涩难懂的callback机制来衔接处理流程yield生成器是php5.5之后出现的,yield提供了一种更容易的方法来实现简单的迭代对象,相比较定义类实现 Iterator 接口的方式,性能开销和复杂性大大降低。生成器会对PHP应用的性能有非常大的...原创 2018-08-13 20:17:16 · 206 阅读 · 0 评论 -
centos7.4安装nginx1.15.2 php7.2 mysql8.0
参考:linux(CentOS7.4) 安装 Nginx 1.15.2:https://blog.csdn.net/u011159417/article/details/81585861centos7源码安装php7.2 :http://www.zixuephp.net/article-394.html1、 查看centos 版本cat /etc/redhat-release2...原创 2018-09-06 18:06:35 · 583 阅读 · 0 评论 -
thinkphp 使用paginate 分页 foreach 循环体内不能操作数据的解决办法
//官网商品链接public function index(){ $goods_name = I('goods_name'); // goods_name $where = [ 'is_on_sale' => 1, 'endtime' => ['>',time()] ]; $where['goods_conten...原创 2018-09-10 09:50:31 · 2808 阅读 · 0 评论 -
php 图片裁剪(保存图片 和 不保存图片)
案例一:<?php$src_path = 'https://guwanc.oss-cn-shanghai.aliyuncs.com/video/output/outimgs/2018/09/19/153734256819844_00001.jpg';//创建源图的实例$src = imagecreatefromstring(file_get_contents($src_path)...原创 2018-09-19 17:17:03 · 2660 阅读 · 0 评论 -
人机验证(阿里云)
文档链接:https://help.aliyun.com/document_detail/66318.html?spm=a2c4g.11186623.6.561.5daf6556o9exxT这里我选择阿里云提供的产品(向右滑动验证 H5 版本),当然其他平台产品也可以1,快速入门,2,进入控制台,添加人机验证 配置,下载 php版本的SDK3,客户端代码<h...原创 2018-09-21 17:03:42 · 11548 阅读 · 0 评论 -
bootstrap js 触发模态框案例
示例代码如下:<!DOCTYPE html><html><head> <meta charset="utf-8"> <title>Bootstrap 实例 - 模态框(Modal)插件</title> <link rel="stylesheet" href=原创 2018-10-10 09:49:22 · 5008 阅读 · 0 评论 -
Php 同步日历任务 .ics 文件
.ics文件 实例BEGIN:VCALENDARPRODID:-//Events Calendar//iCal4j 1.0//ENCALSCALE:GREGORIANVERSION:2.0X-WR-TIMEZONE:Asia/ShanghaiBEGIN:VEVENTDTSTAMP:20181206T030305ZDTSTART;TZID=Asia/Shanghai:2018112...原创 2018-12-06 11:11:20 · 1673 阅读 · 0 评论 -
hash 加密 解密
参考示例:https://blog.csdn.net/fd2025/article/details/800356471,对称加密:密钥只有一个,解密、解密都是这个密码,加解密速度快,典型的对称加密有DES、AES、RC4等2,非对称加密:密钥成对出现,分别为公钥和私钥,从公钥无法推知私钥,反之,从私钥也无法推知公钥,加密和解密使用不同的密钥,公钥加密需要私钥解密,反之,私钥加密需要公钥解密。...原创 2019-04-02 18:16:38 · 7517 阅读 · 0 评论 -
正则过滤
//正则过滤数字 特殊字符串$str = '#$%^4sdfg3哈哈sdfgfdg$@#%@#$%AS<h>?><,.~!tt。方法15343719375';echo preg_replace('/([^a-z\x{4e00}-\x{9fa5}]+)/u','', $str);//结果 sdfg哈哈sdfgfdghtt方法echo '<hr/>';//正则过滤数...原创 2018-03-29 19:41:58 · 2004 阅读 · 0 评论 -
阿里云OSS对象存储
composer安装方式composer require aliyuncs/oss-sdk-php2.tp5中的aliyun配置文件'aliyun'=>[ 'accessKeyId'=> 'LTAIK8hGVmhUlOd5', 'accessKeySecret'=> 'XzNA8EBLMuH9SKQZqwdDa0dyDb3TOG', 'endpoint'=...原创 2018-02-25 11:20:16 · 4314 阅读 · 0 评论 -
php中 传值 和 传引 用的区别
传值 是把实参的值赋值给行参 那么对行参的修改,不会影响实参的值传地址 是传值的一种特殊方式,只是他传递的是地址,不是普通的如int 那么传地址以后,实参和行参都指向同一个对象 $b = &$a; $b的地址指向$a的地址,两者指向同一个对象传引用 真正以地址的方式传递参数后,行参和实参都是同一个对象,只是他们名字不同而已,对行参修改将影响实参值。 即传址时只需...原创 2018-03-03 10:44:57 · 172 阅读 · 0 评论 -
win下安装composer
1,打开php.ini文件,开启openssl扩展。去掉extension=php_openssl.dll前面的分号(;)2,添加全局环境变量(和php.exe同级目录的路径)例如:D:\apache_php\php添加到环境变量path里3,下载composer.phar,下载地址:Composer.phar 。将composer.phar文件放入php目录下,在php目录下新建一个文件原创 2017-11-01 21:22:49 · 199 阅读 · 0 评论 -
Tp5.0 PHPMailer邮件发送
1,运行 composer require phpmailer/phpmailer TP5.0 框架的extend文件夹里面namespace app\index\controller;use PHPMailer\PHPMailer\PHPMailer;use PHPMailer\PHPMailer\Exception;use think\Controller;class原创 2017-12-19 22:26:47 · 568 阅读 · 0 评论 -
PHP常用数组(Array)函数
一、数组操作的基本函数数组的键名和值array_values($arr); 获得数组的值array_keys($arr); 获得数组的键名array_flip($arr); 数组中的值与键名互换(如果有重复前面的会被后面的覆盖)in_array("apple",$arr); 在数组中检索applearray_search("apple",$arr); 在数转载 2017-12-19 22:47:47 · 378 阅读 · 0 评论 -
php生成 文字水印 图片水印
<?php$dst_path = 'dst.jpg';$src_path = 'src.jpg';//创建图片的实例$dst = imagecreatefromstring(file_get_contents($dst_path)); //大图$src = imagecreatefromstring(file_get_contents($src_path)); //小图//获取水原创 2017-12-21 19:17:54 · 949 阅读 · 0 评论 -
ThinkPHP3.23整合phpqrcode生成二维码(logo)
/** * 调用phpqrcode生成二维码 * @param string $url 二维码解析的地址 * @param int $level 二维码容错级别 * @param int $size 需要生成的图片大小 */ public function qrcode($url="http://blog.csdn.net/zh原创 2017-12-18 17:38:41 · 539 阅读 · 0 评论 -
thinkphp5 对象转数组
DB操作返回是数组。模型直接操作返回是对象 对象类型转换数组打开 database.php 增加或修改参数'resultset_type' => '\think\Collection',即可连贯操作model('user')->select()->toArray()原创 2018-01-21 14:04:57 · 8319 阅读 · 0 评论 -
每日持续签到,累计签到,送积分
一,功能要求 如图:二,数据表字段:三,相关代码如下://签到页面(累计签到)public function signedCount(Request $request){ $user_id = (int)$this->user_data['user_id']; //当前登录者user_id; $sign_msg = Db::name('users')-原创 2018-01-09 10:13:48 · 23372 阅读 · 4 评论 -
tp5 phpexcel 导入,导出 excel表格
一,Excel导入:1,composer 安装phpExcel:composer require phpoffice/phpexcel (好像只有Classes里面的文件有用,其他可删除)2,前端代码form method="post" action="{:url('student/savestudentImport')}" class="form-signin"原创 2018-01-30 14:54:46 · 743 阅读 · 0 评论 -
PHP使用PHPExcel导出,导入数据总结
导出excel:转自:http://blog.csdn.net/hwhjava/article/details/48023517[php] view plain copyheader("Content-type: text/html; charset=utf-8"); include_once dirname(dirname(_转载 2018-01-30 18:05:06 · 2857 阅读 · 0 评论 -
选择部门->选择员工(js)
一,前端html JS代码如下:<div class="pagecontent"> <!-- row --> <div class="row"> <!-- col --> <div class="col-md-12"> <!原创 2018-03-08 09:53:15 · 6031 阅读 · 0 评论 -
php生成Excel表格 .csv格式
$datalists = isset($datas) ? $datas : '';if( $datalists!=1){ $datalist=unserialize($datalists); $re_list = []; foreach($datalist as $sk=>$sv){ $sv = array_reverse($sv); ...原创 2018-03-08 10:14:46 · 227 阅读 · 0 评论