![](https://img-blog.csdnimg.cn/20201014180756913.png?x-oss-process=image/resize,m_fixed,h_64,w_64)
php
php的绯闻女友
日日无事 事复日日 忙忙亦茫茫
展开
-
记 Hyperf booted模型事件的使用
原来是因为我创建完数据后,会马上查询该内容,并为该内容添加上一段关联关系,不过因为加上了全局查询的原因,现在查询不到该内容,所以就报错了。产品经理提了一个需求,要求能自定义内容的创建时间,当前事件大于创建时间时,才能查询到这些内容,并对内容进行操作。我的第一反应:不算麻烦,只需要在仓储层的查询方法中,给每个查询都多加一个查询条件不就好了吗。于是勤勤恳恳的写完了,检查代码时,却犹豫了,有没有更好的办法呢?翻了翻laravel的相关文档,果然发现了有用的东西。记录一次小小的经历~今天的天气是阴天,我喜欢。原创 2024-02-29 15:01:48 · 640 阅读 · 0 评论 -
Linux PHP多版本编译安装及快捷切换版本
安装多个版本的PHP其实毫无压力,主要是编译安装的时候--prefix和--with-config-file-path设置为不同的目录即可。这是开了debug的版本,但是开发的同学一般都不需要,直接去掉即可。编译安装完成后,记得初始化php.ini,将php.ini-production文件重命名为php.ini并放在--with-config-file-path定义的目录中即可。但是此时,还不能使用PHP命令,因此需要将PHP的运行目录写入到.bashrc中,即。原创 2022-08-19 11:31:40 · 1528 阅读 · 0 评论 -
Centos PHP8.1编译安装pdo_mysql扩展
编译安装pdo_mysql原创 2022-05-24 13:36:29 · 1093 阅读 · 0 评论 -
ubutnu20.0.4源码编译安装PHP8.1
下载源码包wget https://www.php.net/distributions/php-8.1.4.tar.gz解压tar -zxvf php-8.1.4.tar.gz安装依赖sudo apt install libxml2-dev --xml C语言解析器sudo apt install gccsudo apt install libsqlite3-dev --SQL软件库创建一个php文件夹sudo mkdir /usr/local/php.原创 2022-03-22 09:06:04 · 611 阅读 · 1 评论 -
ubuntu Hyperf-skeleton初体验
编译Swoole扩展了解Hyperf框架使用Hyperf-skeleton搭建一个项目,并且成功启动一个服务,访问它能够显示HelloWorld原创 2022-03-18 21:32:56 · 612 阅读 · 0 评论 -
apache+php环境配置
apache+php7.4环境安装配置原创 2022-03-10 14:03:44 · 11644 阅读 · 5 评论 -
tp5查询每月业绩
$arr="select sum(order_amount) as amount,FROM_UNIXTIME(create_time,'%Y-%m') as time,user_id from lx_order where user_id =".$id." and order_type=2 GROUP BY FROM_UNIXTIME(create_time,'%Y-%m')"; $data=Db::query($arr);原创 2021-12-06 15:19:01 · 521 阅读 · 0 评论 -
php-微信表情的存储和显示
1.存储表情之前先调用一个函数/**转义emoji */function userTextEncode($str){ if(! is_string($str)) return $str; if(!$str || $str=="undefined")return ""; $text = json_encode($str); //暴露出unicode $text = preg_replace_callback("/(\\\u[ed][0-9a-f]{3})/i",fu转载 2021-11-29 15:44:27 · 271 阅读 · 0 评论 -
tp5查询时将时间戳直接转为年月日类型
很简单,改一下field即可。$result=Db::name('clock')->where('stu_id',$stu_id)->where('class_id',$class['class_id'])->join('lx_course','lx_course.id=lx_clock.course_id')->group('course_id')->field('lx_clock.id,course_id,stu_id,course_name,FROM_UNIX原创 2021-11-24 14:08:59 · 1041 阅读 · 0 评论 -
tp5报错:Indirect modification of overloaded element of think\Collection has no effect
近日使用tp5时报错:Indirect modification of overloaded element of think\Collection has no effect解决办法:在select查询语句后面加上toArray()例:原创 2021-11-24 11:26:38 · 1317 阅读 · 0 评论 -
tp5上传文件时不改变原文件名
//上传音频 public function uploadAudio(){ $audio=request()->file('file'); if($audio){ $info = $audio->move('static/uploads/courseAudio/'.date('Ymd').'/',''); if($info){ // 成功上传后 获取上传信息 .原创 2021-10-21 11:26:25 · 599 阅读 · 0 评论 -
tp5控制器接收post的数组时出现variable type error:array的报错
错误代码:$data=\request()->post('data');正确做法:其中post.data中的data在post中自定义:$data=input('post.data/a');原创 2021-10-20 10:14:15 · 272 阅读 · 0 评论 -
tp5-移动文件的位置
if($data['picture_input']!=''){ //判断图片是否存在 if(!file_exists('static/uploads/category/0/'.$data['picture_input'])){ return ['code'=>0,'msg'=>'类别图片丢失,请重新添加','/static/uploads/category/0/'.$data['pictur.原创 2021-09-02 22:27:33 · 557 阅读 · 0 评论 -
thinkphp order明显不对的问题
最近写代码的时候需要用到排序,但是发现有时候使用order排出来的顺序明显不对,经过排查,是数据库字段的值问题。需要用到排序的列的字段类型最好使用int,不要使用varchar!!!!!!原创 2021-07-18 02:47:46 · 274 阅读 · 0 评论 -
jQuery解决点击一次却出现多次点击的效果
首先上图:这行代码的效果是当点击加号时,出现一个input框。点击第一次时,它是正常的,但当我关闭弹窗后再点击一次,它出现了点击两次的效果,关闭后再点击会出现点击三次的效果。就很诡异解决办法之一:加一个unbind(),删除click事件的处理程序后再click$(document).unbind().on('click', '.question-type-pane a.add-option', function () { var parent = $(this).原创 2021-01-30 08:44:25 · 501 阅读 · 0 评论