
php
咳咳,您好请多指教!
咳咳,您好请多指教!
展开
专栏收录文章
- 默认排序
- 最新发布
- 最早发布
- 最多阅读
- 最少阅读
-
ubuntu 下 安装 swoole 扩展
wget https://codeload.github.com/swoole/swoole-src/tar.gz/v4.5.2tar zxvf v4.5.2 && cd swoole-src-4.5.2apt install php-devphpize./configuremakemake installfind /etc -name "php.ini"vim /etc/php/7.4/cli/php.ini extension=swoolevim /etc/p原创 2021-09-23 10:53:44 · 657 阅读 · 1 评论 -
无限分类 查找子集与查找上级 节点
此方法 适用于多个表无限分类查找子集,限定是表结构一样,考虑性能 仅仅new 一个对象/* * by:lwl * 无限极分类查找某个节点下的所有 子类 * model:模型类 例如:Cate::class * id:最高父类节点 * isSelf:true:数组返回自己,false:数组不返回自己 * data:返回数组 */if (!function_exists('getAllNextId')) { function getAllNextId($model, $id, $i.原创 2021-07-29 17:18:29 · 365 阅读 · 0 评论 -
php常用内置函数判断对比
原创 2021-07-20 10:00:57 · 142 阅读 · 0 评论 -
设计模式 白话文
1.单例模式保证一个类仅有一个实例,并提供一个访问它的全局访问点2.代码事例:class Mysql{ private static $instance = null; public static function getInstance() { if (is_null(self::$instance)) { self::$instance = new self(); } return self::$原创 2021-06-02 15:27:23 · 203 阅读 · 1 评论 -
interface 与 abstract 对比
相同点:(1) 两者都是抽象类,都不能实例化。(2) interface 实现类及 abstract class 的子类都必须要实现已经声明的抽象方法。不同点:(1) interface 需要实现,要用 implements ,而 abstract class 需要继承,要用 extends 。(2) 一个类可以实现多个 interface ,但一个类只能继承一个 abstract class 。(3) interface 强调特.原创 2021-05-27 09:17:10 · 168 阅读 · 0 评论 -
oss下载文件 重新命名
if (!function_exists('ossSignUrlNewName')) { function ossSignUrlNewName($fileName, $fileNewName, $timeout = 120) { $accessKeyId = "LTAI4FgM7UcVCfi73xQGAzYK"; $accessKeySecret = "FgWpumKUKavg3SG4oy4bFqRbxVgbp3"; $endpoint = "原创 2020-11-12 10:28:24 · 1053 阅读 · 0 评论 -
laravel event
1.laravel event 事件(观察者模式)php artisan make:event // 创建事件php artisan make:listener // 创建事件监听者,可以为多个。2.app/Providers/EventServiceProvider.php这里写逻辑控制器调用event(new AdminLoginEvent($token));...原创 2020-09-07 14:45:27 · 144 阅读 · 0 评论 -
thinkphp项目初始化 install文件
前提:此功能在 thinkphp5 上开发的,可以移植到 thinkphp 其他版本上1.新增命令行2.创建 install.php 文件 并在同级 存放 安装的.sql文件<?phpnamespace app\install;use app\util\Random;use think\console\Command;use think\console\Input;use think\console\input\Option;use think\console\Output原创 2020-09-06 12:46:54 · 1228 阅读 · 0 评论 -
laravel7配置跨域
1.config/cors.php 这个cors 文件 全部复制下面的代码return [ /* * You can enable CORS for 1 or multiple paths. * Example: ['api/*'] */ 'paths' => [], /* * Matches the request method. `[*]` allows all methods. */ 'allowed_meth原创 2020-08-23 10:22:05 · 738 阅读 · 0 评论 -
thinkph6模型事件
模型事件首先,从手册上,我们可以知道模型支持以下事件:事件 描述 事件方法名after_read 查询后 onAfterReadbefore_insert 新增前 onBeforeInsertafter_insert 新增后 onAfterInsertbefore_update 更新前 onBeforeUpdateafter_update 更新后 onAfterUpdatebefore_write 写入前 onBeforeWriteafter_write原创 2020-06-17 14:50:21 · 785 阅读 · 0 评论 -
laravel Validator 验证
use Illuminate\Support\Facades\Validator; $data = $request->all(); $rules = [ 'name' => 'required|max:12|min:3', 'mobile' => 'integer|required', ]; //定义提示信...原创 2020-03-22 20:49:21 · 330 阅读 · 0 评论 -
Ubuntu下安装 nginx+ php7.2
安装 nginxsudo apt-get install nginx -y启动 nginxsudo service nginx restart浏览器访问 :localhost安装phpsudo apt-get install php7.2 php7.2-fpm php7.2-mysql设置 php 相关配置sudo vim /etc/php/7.2/fpm/pool.d/w...原创 2020-02-28 22:38:47 · 529 阅读 · 0 评论