Dev
搜索

Dev

swoft获取cookie和设置cookie
发表于2019-03-16|php
文档中没有介绍但经过分析,用法如下 获取12request()->cookie()request()->cookie("cookiename") 设置12use Swoft\Http\Message\Cookie\Cookie;$response->withCookie(new Cookie($key, $value, $expire, $path, $domain, $secure, $httponly)); 补充所有的方法封装在以下文件中swoft\http-message\src\Server\Request.phpswoft\http-message\src\Server\Concerns\InteractsWithInput.php 12Swoft\Http\Message\Server\RequestSwoft\Http\Message\Server\Concerns\InteractsWithInput
swoft 中间件 传递数据 request
发表于2019-03-16|php
经过查看源码 1request() 方法会获取当前请求上下文,并在请求结束时销毁,所以可以安全使用他传递数据例如中间件获取用户信息结束后可以 123$req = request();$req->user = $udata;$req->openid = $openid;
swoft 支持 OPTIONS 请求
发表于2019-03-15|php
如果路由中不明确设置,swoft默认只使用了post get请求只要在控制器中明确声明OPTIONS请求即可
swoft 中间件 基本使用
发表于2019-03-15|php
swoft中间件在请求到达控制器之前拦截请求,主要有两种写法 1. 不合法请求12// 直接返回response对象return response() 2. 合法请求12$response = $handler->handle($request);return $response;
easywechat4 开放平台 第三方平台 调用 公众号 jssdk 接口
发表于2019-03-11|php
从微信官方文档中,我们可以知道做这个事情需要一个authorizer_access_token,获取这个需要三个参数component_appid authorizer_appid authorizer_refresh_token默认情况下,你从sdk里传1个appid参数就好了,但是这还不够实际上,sdk没有维护authorizer_refresh_token,这个参数是在用户同意授权时,一起发给我们的,我们需要自己维护,并在调用时传到sdk大致上形如: 12$refresh = (new Component)->getRefreshToken($appid);$app = $open->officialAccount($appid, $refresh);
swoft 获取 容器 swoole_http_server 进程worker_id
发表于2019-03-08|php
获取容器123$con = Swoft\Bean\BeanFactory::getContainer();$app = $con->getBeanNames();return var_export($app,true); 通过BeanFactory类可以操作所有的bean通过以上方法可以获取所有的bean名 获取swool_http_server1234$http = Swoft\App::$server;$server = $http->getServer();$pid = $server->worker_pid;return var_export($pid, true);
windows 安装 wsl 跑 swoole swoft
发表于2019-03-07|php
打开wsl控制面板打开linux子系统 安装子系统在cmd里执行bash或者wsl即可,cmd提示需要安装,可以去商店安装,如果把删除了可以执行 1lxrun /install /y 他会自己下载 安装目录1C:\Users\YourName\AppData\Local\lxss\ 安装swoole从官网下载swoole的二进制包,然后执行加压 1tar -Jxf swoole-4.3.0.tar.xz 运行swoft使用完整的目录即可 1/home/bin/php /mnt/c/php/www/swoft/bin/swoft start
swoole 协程异步 带来的性能提升 压力测试
发表于2019-03-05|php
均访问同一cdn数据,模拟访问远程接口的情况 协程异步2009qps同步阻塞432qps协程压测12345678910111213141516171819202122232425262728Concurrency Level: 200Time taken for tests: 0.498 secondsComplete requests: 1000Failed requests: 0Total transferred: 209000 bytesHTML transferred: 19000 bytesRequests per second: 2009.49 [#/sec] (mean)Time per request: 99.528 [ms] (mean)Time per request: 0.498 [ms] (mean, across all concurrent requests)Transfer rate: 410.14 [Kbytes/sec] receive...
thinkphp beego swoft yaf 性能测试 压力测试 php go swoole 速度对比 helloworld
发表于2019-03-04|others
1ab -n 10000 -c 200 测试机为腾讯云1核1G普通云硬盘,如果用ssd的话php成绩会有所提升 输出内容为时间戳 beego swoft的性能都强的不得了,在同一级别,裸跑性能都逼近nginx处理静态文件nginx转发损耗很大,由于nginx转发会导致thinkphp,swoft,beego的性能几乎一样。所以有可能的话还是不要在这些框架外套个nginx了swoft+nginx:内存无波动,CPU占用81%swoft无nginx:内存无波动,CPU占用34% thinkphp+nginx41212345678910111213141516171819202122232425262728Concurrency Level: 200Time taken for tests: 24.256 secondsComplete requests: 10000Failed requests: 0Total transferred: 1940000 bytesHTML transferred: 190000 by...
swoft 开发的坑 路由不生效
发表于2019-03-04|php
自动重载代码失效根据实测,修改文件必须手动重启swoft,自动重载根本没有卵用
1…313233…102
avatar
developer
AI相伴的开发者博客
文章
1020
标签
721
分类
35
Follow Me
公告
This is my Blog
最新文章
taro+tailwind开发记录2026-04-07
hono js 使用记录2026-03-31
cmder使用记录2026-03-08
flutter getx使用记录2026-03-01
统计代码行数2026-02-27
分类
  • apicloud3
  • bootstrap8
  • cmder1
  • cocos2d-js5
  • createjs17
  • day45
  • docker16
  • egret14
标签
备份 bug SSL 部分产品对比 utf8 常用算法 nginx ffmpeg 占位符 swarm 效果 等工具 1 语法高亮 conda jssdk ibdata1 模板字符串 读取 模型初始化 wp_filter 启动 数据不更新问题 腾讯云 nginx日志 获取 恢复 我的全新开始 指定目录 无法开启 文件 攻击 M方法 macos 工作模式 laravel trait 播放声音 tsc版本不同 workerman
归档
  • 四月 2026 1
  • 三月 2026 3
  • 二月 2026 5
  • 一月 2026 3
  • 十二月 2025 5
  • 十一月 2025 2
  • 十月 2025 5
  • 九月 2025 5
网站信息
文章数目 :
1020
最后更新时间 :
© 2025 - 2026 By developer框架 Hexo 8.1.1|主题 Butterfly 5.5.4
搜索
数据加载中