
Swoole
徊忆羽菲
追求健康的人
展开
专栏收录文章
- 默认排序
- 最新发布
- 最早发布
- 最多阅读
- 最少阅读
-
swoole学习之协程 Redis 客户端
swoole学习之协程 Redis 客户端协程 Redis 客户端使用示例封装redisServer类set 存数据无有效期设置有效期协程 Redis 客户端使用示例Co\run(function () { $redis = new Swoole\Coroutine\Redis(); $redis->connect('127.0.0.1', 6379); $val = $redis->get('key');});封装redisServer类<?php原创 2020-11-14 16:40:47 · 637 阅读 · 0 评论 -
swoole学习之向mysql服务器发送sql预处理请求
swoole学习之向mysql服务器发送sql预处理请求prepare()prepare()向 MySQL 服务器发送 SQL 预处理请求prepare 必须与 execute 配合使用。预处理请求成功后,调用 execute 方法向 MySQL 服务器发送数据参数。语法Swoole\Coroutine\MySQL->prepare(string $sql, float $timeout): Swoole\Coroutine\MySQL\Statement|false;参数st原创 2020-11-14 15:54:10 · 372 阅读 · 0 评论 -
swoole学习之mysql增删改查事务
swoole学习之mysql增删改查第一步:配置数据库第二步:查询第三步:增加第四步:编辑第五步:删除第一步:配置数据库<?phpclass MysqlService{ //定义一个变量 public $dbSource = ''; public $dbConfig = ''; //定义构造函数 public function __construct() { Co\run(function () { /原创 2020-11-14 15:19:21 · 502 阅读 · 0 评论 -
swoole学习之mysql的error坑笔记
swoole学习之mysql的坑笔记PHP Fatal error: Uncaught Error: Class 'Swoole\Mysql' not found in错误分析解决方案二、PHP Fatal error: Uncaught Swoole\Error: operation not support (reactor is not ready)PHP Fatal error: Uncaught Error: Class ‘Swoole\Mysql’ not found in错误分析原代码原创 2020-11-14 13:54:20 · 911 阅读 · 0 评论 -
swoole学习之毫秒定时器timer使用案例
swoole学习之毫秒定时器timer使用案例websocket服务中加入定时器浏览器中查看效果websocket服务中加入定时器<?php/*swoole定时器 * * */class WsTimer{ //定义host const HOST = '0.0.0.0'; //定义端口号 const PORT = 9502; //定义变量 public $ws = ''; //构造函数 public function _原创 2020-11-08 17:22:04 · 344 阅读 · 0 评论 -
swoole学习之websocket客户端代码
swoole学习之websocket客户端代码<!DOCTYPE html><html lang="zh-CN"><head> <meta charset="utf-8"> <meta http-equiv="content-type" content="text/html; charset=utf-8"> <title>swoole学习之websocket_server服务器代码_徊忆羽菲的博客-CSDN原创 2020-11-08 17:19:29 · 361 阅读 · 1 评论 -
swoole学习之 websocket中task任务使用案例
swoole学习之 websocket中task任务使用案例websocket基础类增加task方法效果websocket基础类增加task方法<?php/*优化websocket基础类 * * */class WsTask{ //定义host const HOST = '0.0.0.0'; //定义端口号 const PORT = 9502; //定义变量 public $ws = ''; //构造函数 public原创 2020-11-08 16:44:37 · 576 阅读 · 0 评论 -
swoole学习之websocket服务端和客户端
swoole学习之websocket服务端和客户端websocket 服务端websocket 客户端websocket设置参数websocket 服务端websocketService.php<?php//实例化 websocket 服务$server = new Swoole\WebSocket\Server("0.0.0.0", 9502);//监听websocket链接打开事件$server->on('open', function (Swoole\WebSocket\Se原创 2020-11-08 15:30:23 · 1377 阅读 · 2 评论 -
swoole学习之http_server服务器代码
swoole学习之http服务器代码Http\Server介绍Http\Server介绍Http\Server 继承自 Server,所以 Server 提供的所有 API 和配置项都可以使用,进程模型也是一致的内置 HTTP 服务器的支持,通过几行代码即可写出一个高并发,高性能,异步 IO 的多进程 HTTP 服务器。<?php//创建Server对象,监听 127.0.0.1:9501端口$http_server = new Swoole\Http\Server('0.0.0.0',原创 2020-11-08 12:57:55 · 514 阅读 · 1 评论 -
swoole 学习之 tcp、udp服务端和客户端代码总结
swoole 学习之 tcp、udp服务端和客户端示例代码整理tcp服务tcp服务端tcp客户端tcp客户端键盘输入udp服务udp服务端udp客户端tcp服务tcp服务端<?php//创建Server对象,监听 127.0.0.1:9501端口$serv = new Swoole\Server("127.0.0.1", 9501);//配置$serv->set([ 'worker_num' => 8,//worker进程数 cpu 1-4倍 'max_r原创 2020-11-08 12:37:56 · 343 阅读 · 0 评论 -
使用Swoole服务搭建简易聊天室代码
使用Swoole服务搭建简易聊天室服务端客户端启动服务端浏览器中访问聊天室服务端创建chatserver.php 文件<?phpclass Chat{ const HOST = '0.0.0.0';//ip地址 0.0.0.0代表接受所有ip的访问 const PART = 81;//端口号 private $server = null;//单例存放websocket_server对象 public function __construct() {原创 2020-09-15 10:05:32 · 473 阅读 · 0 评论 -
macos下使用pecl安装swoole扩展的方法
执行sudo pecl install swoole可能报错找不到php.hfatal error: 'php.h' file not found #include "php.h" ^ 1 error generated. make: *** [swoole.lo] Error 1 ...原创 2020-01-11 12:51:28 · 1251 阅读 · 1 评论 -
mac安装swoole提示: fatal error: ‘openssl/ssl.h‘ file not found
swoole.h:620:10: fatal error: 'openssl/ssl.h' file not found分析openssl文件拷贝分析$ssl需要依赖openssl,必须在编译swoole时启用–enable-openssl1.确认是否安装了 openssl如果没有安装,先安装,如果已经安装,则看第二步2. 确认 openssl 库是否在标准位置中既然出现了错误当然就...原创 2020-01-09 11:13:07 · 2683 阅读 · 0 评论 -
Cannot install, php_dir for channel “pecl.php.net“ is not writeable by the current user
Cannot install, php_dir for channel "pecl.php.net" is not writeable by the current user安装swoole报错安装swoole报错执行命令:pecl install swoole报错这是没有权限执行,好的,前面带上sudo 就行了...原创 2020-01-05 20:44:14 · 4467 阅读 · 1 评论 -
WARNING: channel “pecl.php.net“ has updated its protocols
WARNING: channel "pecl.php.net" has updated its protocols, use "pecl channel-update pecl.php.net" to update安装swoole报错解决方案:安装swoole报错pecl install swooleWARNING: channel “pecl.php.net” has updated it...原创 2020-01-05 20:20:02 · 4205 阅读 · 0 评论 -
安装swoole报错:无法建立ssl解决办法
无法建立ssl解决办法yum -y install openssl openssl-devel gcc make perl原创 2019-12-19 15:43:33 · 1053 阅读 · 0 评论 -
安装swoole完成之后出现undefined symbol: mysqlnd_find_charset_nr in Unknown on line 0错误
安装swoole完成之后出现undefined symbol: mysqlnd_find_charset_nr in Unknown on line 错误 解决方案当我安装完成之后,执行: php -m指令之后,出现了如下的错误:[root@qipa250 ~]# php -m PHP Warning: PHP Startup: Unable to load dynamic library ‘...原创 2019-12-19 14:27:59 · 2058 阅读 · 0 评论 -
解决:fatal error: openssl/ssl.h: No such file or directory
fatal error: openssl/ssl.h: No such file or directory要解决这个问题,你需要安装 OpenSSL 开发包,执行以下命令进行安装,然后重新编译即可解决CentOS系统执行以下命令[root@localhost]# sudo yum install openssl-develUbuntu系统执行以下命令[root@localhost]...原创 2019-12-19 14:10:22 · 30988 阅读 · 2 评论 -
pecl install swoole报错:WARNING: channel “pecl.php.net“ has updated its protocols
pecl install swoole报错:WARNING: channel "pecl.php.net" has updated its protocols, use "pecl channel-update pecl.php.net" to updatepecl 安装swoole扩展报错接着报错pecl 安装swoole扩展报错执行pecl channel-update pecl.ph...原创 2019-12-17 19:22:23 · 2032 阅读 · 0 评论 -
在已经编译好安装的php7.1中安装swoole扩展
一、下载swoole扩展下载地址:http://pecl.php.net/package/swoole wget -c http://pecl.php.net/get/swoole-4.2.1.tgz二、解压swoole包 tar xzvf swoole-4.2.1.tgz cd swoole-4.2.1三、生成configure配置文件/usr/loc...原创 2019-12-13 15:36:28 · 429 阅读 · 0 评论 -
php使用 Swoole - event-loop循环线程实现多个客户端聊天示例代码
php使用 Swoole - event-loop循环线程实现多个客户端聊天示例代码服务端代码客户端代码执行步骤服务端代码 <?php// Serverclass Server{ private $serv; public function __construct() { $this->serv = new swoole_serve...原创 2019-11-17 22:42:50 · 395 阅读 · 0 评论 -
php使用 Swoole - TaskWorker进程实现异步操 Mysql数据库示例代码
数据库设计/* Navicat Premium Data Transfer Source Server : 20.20.24.12 Source Server Type : MySQL Source Server Version : 50641 Source Host : 20.20.24.12:3306 Source Schema ...原创 2019-11-16 22:45:40 · 357 阅读 · 0 评论 -
swoole-环境搭建及扩展安装教程
swoole-环境搭建及扩展安装教程第一章 环境搭建及扩展安装第一章 环境搭建及扩展安装环境说明:系统:Ubuntu14.04 (安装教程包括CentOS6.5)PHP版本:PHP-5.5.10swoole版本:1.7.6-stable####PHP安装要用swoole,首先需要有PHP环境。由于swoole的某些特性,最好是能够从源码编译安装PHP,这样在使用过程中可以避免很多不必...原创 2019-07-30 17:22:18 · 479 阅读 · 0 评论