Git Product home page Git Product logo

demo's Introduction

EASYSWOOLE DEMO

关于具体 demo 在哪

demo/3.x 分支对应了 EasySwoole 3.x 版本的 demo3.x 主要是 EasySwoole 基础使用的例子,其他使用请看 3.x 对应的分支。

如何运行 DEMO

安装项目时请不要覆盖默认的配置文件(dev.php / produce.php)以及 EasySwooleEvent 事件注册文件(EasySwooleEvent.php

安装 EasySwoole

git clone https://github.com/easy-swoole/demo.git
cd demo
git checkout 3.x
composer install
php vendor/easyswoole/easyswoole/bin/easyswoole install
composer dump-autoload

配置数据库

dev.php 中的 MYSQL 配置项中配置数据库

安装项目数据库

运行 /Doc/sql.sql 文件

启动项目

启动项目

php easyswoole server start

访问 url

管理员登陆: http://127.0.0.1:9501/Api/Admin/Auth/login?account=xsk&password=123456 
公共请求banner: http://127.0.0.1:9501/Api/Common/Banner/getAll
会员登陆: http://127.0.0.1:9501/Api/User/Auth/login?userAccount=xsk&userPassword=123456

请先认真阅读手册 再进行体验

  • EASYSWOOLE 在线手册

  • QQ 交流群

    • VIP 群 579434607 (本群需要付费599元)
    • EasySwoole 官方一群 633921431(已满)
    • EasySwoole 官方二群 709134628(已满)
    • EasySwoole 官方三群 932625047(已满)
    • EasySwoole 官方四群 779897753(已满)
    • EasySwoole 官方五群 853946743
  • 商业支持:

demo's People

Contributors

a2235565 avatar anythink-wx avatar chinasor avatar dupengshenyang avatar encircles avatar evalor avatar feng409 avatar guanhui07 avatar hanwenbo avatar hekuntong avatar jinchaojian avatar junjunya1995 avatar kajweb avatar kiss291323003 avatar landercy avatar lienze741 avatar maikuolan avatar mistaker avatar nicholaschan1025 avatar player626 avatar qq690712575 avatar rongmic avatar runstp avatar sth4me avatar tioncico avatar tocurd avatar webphplove avatar windrunner414 avatar xuesilf avatar yaphats avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

demo's Issues

异步保存聊天信息

ChatMessage中使用了单例模式,由于swoole 是常驻进程,当ChatMessage实例化后,storage 属性会一直是同一个值,createStorage()这个方法就没有什么多大的意义了。在聊天室的demo 中,作者特别喜欢使用单例模式,个人觉得单例模式有优点也有缺点,不必用太多。。

关于魔术方法的问题

为什么在demo中的UserBean不使用__get与__set魔术方法而是使用写死的get(set)+属性名这种方式,仅仅只是考虑效率的原因,还是将来会加入set/get的注解?

Fatal error: Namespace

Fatal error: Namespace declaration statement has to be the very first statement or after any declare call in the script in /www/wwwroot/bgx/demo/vendor/bin/easyswoole on line 13

启用心跳检测 不起作用

开启了心跳检测,但是close一直没有日志输出

        $subPort->set(
            [
                'open_eof_check' => true, //打开EOF检测
                'package_eof' => '##', //设置EOF
                'open_eof_split' => true,
                'heartbeat_idle_time' => 60,
                'heartbeat_check_interval' => 6,
            ]
        );

启动时有个报错

当SERVER_TYPE设为EASYSWOOLE_WEB_SOCKET_SERVER就会报这个错,有没有解决方法
image

热重载,修改文件后,报错Swoole\Coroutine\Channel::push(): must be called in the coroutine.

使用热重载,修改文件后,报错
PHP Fatal error: Swoole\Coroutine\Channel::push(): must be called in the coroutine. in /var/html/demo/vendor/easyswoole/http/src/Dispatcher.php on line 238

Fatal error: Swoole\Coroutine\Channel::push(): must be called in the coroutine. in /var/html/demo/vendor/easyswoole/http/src/Dispatcher.php on line 238
Error at file[/var/html/demo/vendor/easyswoole/http/src/Dispatcher.php] line[238] message:[Swoole\Coroutine\Channel::push(): must be called in the coroutine.]
PHP Fatal error: Swoole\Coroutine\Channel::push(): must be called in the coroutine. in /var/html/demo/vendor/easyswoole/http/src/Dispatcher.php on line 238

Fatal error: Swoole\Coroutine\Channel::push(): must be called in the coroutine. in /var/html/demo/vendor/easyswoole/http/src/Dispatcher.php on line 238
Error at file[/var/html/demo/vendor/easyswoole/http/src/Dispatcher.php] line[238] message:[Swoole\Coroutine\Channel::push(): must be called in the coroutine.]

test

运行 3.x-chat 报错不知道哪里弄错了

报错信息
[FatalError][file:/var/www/html/chat-demo/demo/vendor/easyswoole/easyswoole/src/Core.php][line:273]Uncaught TypeError: Argument 2 passed to EasySwoole\EasySwoole\Core::EasySwoole\EasySwoole{closure}() must be an instance of Swoole\Server\Task, integer given in /var/www/html/chat-demo/demo/vendor/easyswoole/easyswoole/src/Core.php:273
Stack trace:
#0 [internal function]: EasySwoole\EasySwoole\Core->EasySwoole\EasySwoole{closure}(Object(Swoole\WebSocket\Server), 16, 5, Object(App\Task\BroadcastTask))
#1 /var/www/html/chat-demo/demo/vendor/easyswoole/easyswoole/src/ServerManager.php(109): Swoole\Server->start()
#2 /var/www/html/chat-demo/demo/vendor/easyswoole/easyswoole/src/Core.php(136): EasySwoole\EasySwoole\ServerManager->start()
#3 /var/www/html/chat-demo/demo/vendor/easyswoole/easyswoole/src/Command/DefaultCommand/Start.php(98): EasySwoole\EasySwoole\Core->start()
#4 /var/www/html/chat-demo/demo/vendor/easyswoole/easyswoole/src/Command/CommandContainer.php(44): EasySwoole\EasySwoole\Command\DefaultCommand\Start->exec(Array)
#5 /var/www/html/chat-demo/demo/vendor/easyswoole/easyswoole/src/Command/Comma

tp 数据库操作

function static frameInitialize()
{
// 获得数据库配置
$dbConf = Config::getInstance()->getConf('database');
// 全局初始化
Db::setConfig($dbConf);
}

为啥这样使用tp 数据库操作不会有协程问题?,没看见代码在哪处理了?

3.x-excel-Demo建议

demo使用的这个phpoffice/phpexcel库,已经停止维护了,迁移到新的项目了,建议换成新的项目composer包.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.