随笔分类 - ThinkPHP
摘要:安装 首先通过 composer 安装 composer require topthink/think-worker SocketServer 在命令行启动服务端 php think worker:server 默认会在0.0.0.0:2345开启一个websocket服务。如果需要自定义参数,可以
阅读全文
摘要:一、Class 'think\Image' not found composer require topthink/think-image 装上了扩展控制器头部加了 use think\Image然后\think\image::open($imgSrc);提示Class 'think\Image'
阅读全文
摘要:<?php //发送手机验证码 function smsCode() { //dump($this->request->post()); //请求方式验证 /*if (!$this->request->isAjax()) { $this->error('请求异常'); }*/ $mobile = $
阅读全文
摘要://防止恶意刷新 function refresh() { //代理IP直接退出 empty($_SERVER['HTTP_VIA']) or exit('访问失败'); //ip限制 $ip=request()->ip(); //黑名单 if(cache('ip_black')&&in_array
阅读全文
摘要:关联模型 $this->hasOne(关联模型的类名, 关联模型的外键, 当前模型的主键); $this->belongsTo(关联模型的类名, 当前模型的外键, 关联模型的主键); $this->hasMany(关联模型的类名, 关联模型的外键, 当前模型主键); $this->belongsTo
阅读全文