随笔分类 -  php-swoole专题

摘要:缘由:为了更好的体验swoole组件优良的协程Mysql客户端,实现更好的并发设计;写了一个小程序。 环境准备: 没有采用任何框架,只是使用了smarty模版,来渲染后端php响应的数据,在一个html文件中有如下实现 html部分 原计划点击提交按钮后,由jquery函数postclick()将请 阅读全文
posted @ 2019-10-11 18:11 saintdingtheGreat 阅读(1584) 评论(0) 推荐(0)
摘要:注意!任何swoole函数都应该包含在go(function(){}) 经典查询方法query() 增强型 防止SQL注入攻击的方法 增强型 带参数的查询样例 插入语句 普通版本 插入语句 带预先处理 阅读全文
posted @ 2019-10-08 14:51 saintdingtheGreat 阅读(949) 评论(0) 推荐(0)
摘要:channel和数组差不多,可以被用作队列,属性capacity是设置容量,isEmpty() isFull() 用来判断队列是空还是满,push()加入队列 pop()弹出队列 测试结果: 实现一个redis连接池 阅读全文
posted @ 2019-07-31 15:05 saintdingtheGreat 阅读(469) 评论(0) 推荐(0)
摘要:laravel项目中的配置 原文出处:https://laravelacademy.org/post/19700.html,感谢原文作者让laravel这款可爱的php框架,进入了高并发的殿堂 然后,你就要到config目录下找到laravels.php,进行一番配置。 找到下列关联数组的键名,并作 阅读全文
posted @ 2019-07-30 20:08 saintdingtheGreat 阅读(1138) 评论(0) 推荐(0)
摘要:目前,较为成熟的技术是采用laravelS组件,注意和laravel 区别laravelS多了一个大写的S,由于laravelS默认监听5200端口,所以laravel项目要做一些调整 例如: 静态文件引入的方式 从静态资源服务器加载 不过放心,虽然“从静态资源服务器加载“听起来要写一些代码实现跨域 阅读全文
posted @ 2019-07-30 03:07 saintdingtheGreat 阅读(300) 评论(0) 推荐(0)
摘要:注意,这种风格的服务端需要swoole4.4以上,这种风格的服务端需要swoole4.4以上,这种风格的服务端需要swoole4.4以上,重要的事情说三遍!!! 服务端 客户端 上述代码均在laravel5.8中实现 然后先运行服务端代码,再运行客户端代码 输出结果: 以为这样就完了?I‘m dee 阅读全文
posted @ 2019-07-24 16:26 saintdingtheGreat 阅读(684) 评论(0) 推荐(0)
摘要:铺垫 前提是先安装swoole组件,我采用从pecl php扩展组件网下载swoole扩展包,然后切入到解压缩的扩展包中运行phpize命令, phpize是一种编译命令,可以在安装文件中生成configure文件,从而方便我们编译安装,接下来 make make install就好。 最后别忘了在 阅读全文
posted @ 2019-07-24 12:41 saintdingtheGreat 阅读(521) 评论(0) 推荐(0)
摘要:object(stdClass)#8 (2) { ["age"]=> int(21) ["expertin"]=> array(2) { [0]=> string(6) "泰拳" [1]=> string(12) "巴西柔术" }}bool(true) #常规方法 #开启兼容模式 swoole4.4 阅读全文
posted @ 2019-07-08 01:36 saintdingtheGreat 阅读(1595) 评论(0) 推荐(0)
摘要:注意: 访问url时,不要采用简写模式,而是要使用形如:http://127.0.0.1:8888/?s=index/index/index,否则我们无法得到期待的访问效果 阅读全文
posted @ 2019-06-29 00:28 saintdingtheGreat 阅读(1825) 评论(0) 推荐(0)
摘要:swoole_table 阅读全文
posted @ 2019-06-07 00:00 saintdingtheGreat 阅读(281) 评论(0) 推荐(0)
摘要:一例串行阻塞操作 异步操作 阅读全文
posted @ 2019-06-06 22:27 saintdingtheGreat 阅读(277) 评论(0) 推荐(0)
摘要:swoole_process 用swoole_http_server实现一例http服务器 实现一个swoole_process对象管理的swoole_http_server进程(文件名:myhttpserver.php) 在linux终端切换到程序所在位置调用php运行脚本swprocess.ph 阅读全文
posted @ 2019-06-06 14:09 saintdingtheGreat 阅读(760) 评论(0) 推荐(0)
摘要:服务端代码 运行结果 打印: 来自1的连接已经建立cpu数量:4finish标识符 1--opcode:1 fd:标识符1Array( [0] => Array ( [name] => 陈培昌 [age] => 22 ) ) 10秒后又打印 0就绪,并返回结果 想去找小烤肠练巴西柔术 阅读全文
posted @ 2019-06-06 00:16 saintdingtheGreat 阅读(394) 评论(0) 推荐(0)
摘要:这一上机实验的开发环境用的是jetbrain公司的phpstorm 上级步骤如下: 创建websocket服务端 准备一个html页面,并在页面中附上websocket协议脚本 在phpstorm中运行写好的前端页面 右键点击要运行的html标签页,运行Run index.html 运行结果 如果运 阅读全文
posted @ 2019-06-05 17:36 saintdingtheGreat 阅读(313) 评论(0) 推荐(0)
摘要: 阅读全文
posted @ 2019-06-05 15:16 saintdingtheGreat 阅读(261) 评论(0) 推荐(0)
摘要:服务端 客户端 阅读全文
posted @ 2019-06-05 02:06 saintdingtheGreat 阅读(288) 评论(0) 推荐(0)
摘要:服务端 客户端 阅读全文
posted @ 2019-06-05 02:04 saintdingtheGreat 阅读(967) 评论(0) 推荐(0)