Coder Social home page Coder Social logo

guanguans / swoole-chat Goto Github PK

View Code? Open in Web Editor NEW
6.0 2.0 4.0 1.37 MB

基于 ThinkPHP5 和 Swoole 开发的聊天室

Home Page: https://guanguans.github.io/swoole-chat

License: Apache License 2.0

PHP 97.02% Shell 0.09% TSQL 2.88%
swoole swoole-extension swoole-framework thinkphp5 php

swoole-chat's Introduction

基于 ThinkPHP5 和 Swoole 开发的聊天室

安装

安装 Swoole 扩展

pecl install swoole

安装 Redis 扩展

pecl install Redis

克隆本项目

git clone https://github.com/guanguans/swoole-live.git
cd swoole-live
composer install

使用

修改 thinkphp/library/think/Request.php 中 pathinfo 和 path 方法

<?php
public function pathinfo()
{
    // if (is_null($this->pathinfo)) {
    if (isset($_GET[$this->config['var_pathinfo']])) {
        // 判断URL里面是否有兼容模式参数
        $pathinfo = $_GET[$this->config['var_pathinfo']];
        unset($_GET[$this->config['var_pathinfo']]);
    } elseif ($this->isCli()) {
        // CLI模式下 index.php module/controller/action/params/...
        $pathinfo = isset($_SERVER['argv'][1]) ? $_SERVER['argv'][1] : '';
    } elseif ('cli-server' == PHP_SAPI) {
        $pathinfo = strpos($this->server('REQUEST_URI'), '?') ? strstr($this->server('REQUEST_URI'), '?', true) : $this->server('REQUEST_URI');
    } elseif ($this->server('PATH_INFO')) {
        $pathinfo = $this->server('PATH_INFO');
    }

    // 分析PATHINFO信息
    if (!isset($pathinfo)) {
        foreach ($this->config['pathinfo_fetch'] as $type) {
            if ($this->server($type)) {
                $pathinfo = (0 === strpos($this->server($type), $this->server('SCRIPT_NAME'))) ?
                substr($this->server($type), strlen($this->server('SCRIPT_NAME'))) : $this->server($type);
                break;
            }
        }
    }

    $this->pathinfo = empty($pathinfo) || '/' == $pathinfo ? '' : ltrim($pathinfo, '/');
    // }

    return $this->pathinfo;
}

public function path()
{
    // if (is_null($this->path)) {
    $suffix   = $this->config['url_html_suffix'];
    $pathinfo = $this->pathinfo();

    if (false === $suffix) {
        // 禁止伪静态访问
        $this->path = $pathinfo;
    } elseif ($suffix) {
        // 去除正常的URL后缀
        $this->path = preg_replace('/\.(' . ltrim($suffix, '.') . ')$/i', '', $pathinfo);
    } else {
        // 允许任何后缀访问
        $this->path = preg_replace('/\.' . $this->ext() . '$/i', '', $pathinfo);
    }
    // }

    return $this->path;
}

public/static/home/js/app.js 中配置

/**
 * 系统配置
 */
var app = {
    // 本地 IP 地址
    host:'http://192.168.10.10:8888',
};

启动服务

php script/web_socker_server.php

平滑重启

sh script/restart_service.sh

浏览器中查看

http://192.168.10.10:8888/static/home/detail.html

License

Apache License 2.0

swoole-chat's People

Contributors

guanguans avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

swoole-chat's Issues

Weekly Digest (19 July, 2020 - 26 July, 2020)

Here's the Weekly Digest for guanguans/swoole-chat:


ISSUES

Last week, no issues were created.


PULL REQUESTS

Last week, no pull requests were created, updated or merged.


COMMITS

Last week there were no commits.


CONTRIBUTORS

Last week there were no contributors.


STARGAZERS

Last week there were no stargazers.


RELEASES

Last week there were no releases.


That's all for last week, please 👀 Watch and Star the repository guanguans/swoole-chat to receive next weekly updates. 😃

You can also view all Weekly Digests by clicking here.

Your Weekly Digest bot. 📆

Weekly Digest (26 April, 2020 - 3 May, 2020)

Here's the Weekly Digest for guanguans/swoole-chat:


ISSUES

Last week, no issues were created.


PULL REQUESTS

Last week, no pull requests were created, updated or merged.


COMMITS

Last week there were no commits.


CONTRIBUTORS

Last week there were no contributors.


STARGAZERS

Last week there were no stargazers.


RELEASES

Last week there were no releases.


That's all for last week, please 👀 Watch and Star the repository guanguans/swoole-chat to receive next weekly updates. 😃

You can also view all Weekly Digests by clicking here.

Your Weekly Digest bot. 📆

Weekly Digest (26 July, 2020 - 2 August, 2020)

Here's the Weekly Digest for guanguans/swoole-chat:


ISSUES

Last week, no issues were created.


PULL REQUESTS

Last week, no pull requests were created, updated or merged.


COMMITS

Last week there were no commits.


CONTRIBUTORS

Last week there were no contributors.


STARGAZERS

Last week there were no stargazers.


RELEASES

Last week there were no releases.


That's all for last week, please 👀 Watch and Star the repository guanguans/swoole-chat to receive next weekly updates. 😃

You can also view all Weekly Digests by clicking here.

Your Weekly Digest bot. 📆

Weekly Digest (19 April, 2020 - 26 April, 2020)

Here's the Weekly Digest for guanguans/swoole-chat:


ISSUES

Last week 1 issue was created.
It is still open.

OPEN ISSUES

💚 #2 [ImgBot] Optimize images, by imgbot[bot]


PULL REQUESTS

Last week, 1 pull request was created, updated or merged.

OPEN PULL REQUEST

Last week, 1 pull request was opened.
💚 #2 [ImgBot] Optimize images, by imgbot[bot]


COMMITS

Last week there were no commits.


CONTRIBUTORS

Last week there were no contributors.


STARGAZERS

Last week there were no stargazers.


RELEASES

Last week there were no releases.


That's all for last week, please 👀 Watch and Star the repository guanguans/swoole-chat to receive next weekly updates. 😃

You can also view all Weekly Digests by clicking here.

Your Weekly Digest bot. 📆

Weekly Digest (5 July, 2020 - 12 July, 2020)

Here's the Weekly Digest for guanguans/swoole-chat:


ISSUES

Last week, no issues were created.


PULL REQUESTS

Last week, no pull requests were created, updated or merged.


COMMITS

Last week there were no commits.


CONTRIBUTORS

Last week there were no contributors.


STARGAZERS

Last week there were no stargazers.


RELEASES

Last week there were no releases.


That's all for last week, please 👀 Watch and Star the repository guanguans/swoole-chat to receive next weekly updates. 😃

You can also view all Weekly Digests by clicking here.

Your Weekly Digest bot. 📆

Weekly Digest (2 August, 2020 - 9 August, 2020)

Here's the Weekly Digest for guanguans/swoole-chat:


ISSUES

Last week, no issues were created.


PULL REQUESTS

Last week, no pull requests were created, updated or merged.


COMMITS

Last week there were no commits.


CONTRIBUTORS

Last week there were no contributors.


STARGAZERS

Last week there were no stargazers.


RELEASES

Last week there were no releases.


That's all for last week, please 👀 Watch and Star the repository guanguans/swoole-chat to receive next weekly updates. 😃

You can also view all Weekly Digests by clicking here.

Your Weekly Digest bot. 📆

Weekly Digest (12 July, 2020 - 19 July, 2020)

Here's the Weekly Digest for guanguans/swoole-chat:


ISSUES

Last week, no issues were created.


PULL REQUESTS

Last week, no pull requests were created, updated or merged.


COMMITS

Last week there were no commits.


CONTRIBUTORS

Last week there were no contributors.


STARGAZERS

Last week there were no stargazers.


RELEASES

Last week there were no releases.


That's all for last week, please 👀 Watch and Star the repository guanguans/swoole-chat to receive next weekly updates. 😃

You can also view all Weekly Digests by clicking here.

Your Weekly Digest bot. 📆

Weekly Digest (3 May, 2020 - 10 May, 2020)

Here's the Weekly Digest for guanguans/swoole-chat:


ISSUES

Last week, no issues were created.


PULL REQUESTS

Last week, no pull requests were created, updated or merged.


COMMITS

Last week there were no commits.


CONTRIBUTORS

Last week there were no contributors.


STARGAZERS

Last week there were no stargazers.


RELEASES

Last week there were no releases.


That's all for last week, please 👀 Watch and Star the repository guanguans/swoole-chat to receive next weekly updates. 😃

You can also view all Weekly Digests by clicking here.

Your Weekly Digest bot. 📆

Weekly Digest (6 April, 2020 - 13 April, 2020)

Here's the Weekly Digest for guanguans/swoole-chat:


ISSUES

Last week, no issues were created.


PULL REQUESTS

Last week, no pull requests were created, updated or merged.


COMMITS

Last week there were no commits.


CONTRIBUTORS

Last week there were no contributors.


STARGAZERS

Last week there were no stargazers.


RELEASES

Last week there were no releases.


That's all for last week, please 👀 Watch and Star the repository guanguans/swoole-chat to receive next weekly updates. 😃

You can also view all Weekly Digests by clicking here.

Your Weekly Digest bot. 📆

Weekly Digest (28 June, 2020 - 5 July, 2020)

Here's the Weekly Digest for guanguans/swoole-chat:


ISSUES

Last week, no issues were created.


PULL REQUESTS

Last week, no pull requests were created, updated or merged.


COMMITS

Last week there were no commits.


CONTRIBUTORS

Last week there were no contributors.


STARGAZERS

Last week there were no stargazers.


RELEASES

Last week there were no releases.


That's all for last week, please 👀 Watch and Star the repository guanguans/swoole-chat to receive next weekly updates. 😃

You can also view all Weekly Digests by clicking here.

Your Weekly Digest bot. 📆

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.